cepianyi-ui/src/utils/i18n.js

15 lines
382 B
JavaScript
Raw Normal View History

2025-05-23 14:14:05 +08:00
import i18n from '@/lang/index.js'
/**
* 获取国际化路由如果不存在则原生返回
* @param {string} title 路由名称
* @returns {string}
*/
export const translateRouteTitle = (title) => {
const hasKey = i18n.global.te('route.' + title)
if (hasKey) {
const translatedTitle = i18n.global.t('route.' + title)
return translatedTitle
}
return title
}