How to use I18N in TS file
admin8756 opened this issue · comments
leelaa commented
I need a config file. To store some static properties. But I18N cannot be used inside.
I created a new config.ts
const { t } = useI18n();
/* 页面底部配置 */
export const FooterFunctionList = [
{
icon: 'home',
name: t('footerList.home'),
func: () => {},
}
]
But when used this way. The project will report an error
Uncaught SyntaxError: Must be called at the top of a setup
function
I think we should provide a method to use in the TS file. This is an excellent template. Adapt the functions that a large project should have.
Anthony Fu commented
IDK, check the docs of https://github.com/intlify/vue-i18n-next