2022-02-24 00:00:57 +08:00
|
|
|
// translate router.meta.title, be used in breadcrumb sidebar tagsview
|
2023-08-04 17:50:25 +08:00
|
|
|
import i18n from "@/lang/index";
|
2022-02-24 00:00:57 +08:00
|
|
|
|
2023-01-13 01:05:45 +08:00
|
|
|
export function translateRouteTitleI18n(title: any) {
|
2022-05-08 13:06:12 +08:00
|
|
|
// 判断是否存在国际化配置,如果没有原生返回
|
2023-08-04 17:50:25 +08:00
|
|
|
const hasKey = i18n.global.te("route." + title);
|
2022-05-08 13:06:12 +08:00
|
|
|
if (hasKey) {
|
2023-08-04 17:50:25 +08:00
|
|
|
const translatedTitle = i18n.global.t("route." + title);
|
2022-05-08 13:06:12 +08:00
|
|
|
return translatedTitle;
|
|
|
|
|
}
|
|
|
|
|
return title;
|
2022-05-04 15:02:33 +08:00
|
|
|
}
|