mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 06:55:06 -04:00
feat(i18n): support for i18n in .ts files (#683)
(cherry picked from commit 732313bfc32a514ef064ca0f90304ff05e2e7ef3)
This commit is contained in:
parent
84a4a646f6
commit
ebb4ec4165
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue