horse soft 基础框架前端界面
autumnal_wind@yeah.net
2024-04-24 47953b9a80adc99ef772d1429691eb069185e532
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// translate router.meta.title, be used in breadcrumb sidebar tagsview
import i18n from '@/lang/index';
 
/**
 * 获取国际化路由,如果不存在则原生返回
 * @param title 路由名称
 * @returns {string}
 */
export const translateRouteTitle = (title: string): string => {
  const hasKey = i18n.global.te('route.' + title);
  if (hasKey) {
    const translatedTitle = i18n.global.t('route.' + title);
    return translatedTitle;
  }
  return title;
};