mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-10-23 04:52:14 +00:00
feat(i18n): support for i18n in .ts files (#683)
(cherry picked from commit 732313bfc32a514ef064ca0f90304ff05e2e7ef3)
This commit is contained in:
@@ -29,3 +29,9 @@ export const i18nPlugin: Plugin = {
|
|||||||
app.use(i18n);
|
app.use(i18n);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const translate = function (localeKey: string) {
|
||||||
|
// @ts-expect-error global
|
||||||
|
const hasKey = i18n.global.te(localeKey, i18n.global.locale);
|
||||||
|
return hasKey ? i18n.global.t(localeKey) : localeKey;
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user