chore(vue3-i18n): prepare vue-i18n-extract and add missing locales in runtime

* Estonian (et)
* Mongolian (mn)
* Burmese (my)

Also, disable unicorn/no-await-expression-member rule for convenience
This commit is contained in:
Fernando Fernández 2022-11-25 13:19:43 +01:00
parent c43bb66d8c
commit 77793fb7b3
3 changed files with 24 additions and 5 deletions

View File

@ -64,7 +64,7 @@ module.exports = {
bundledDependencies: false
}
],
'import/no-nodejs-modules': ['error', { allow: ['vite.config.ts'] }],
'import/no-nodejs-modules': 'error',
'no-restricted-imports': [
'error',
{
@ -162,6 +162,7 @@ module.exports = {
'unicorn/filename-case': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/no-await-expression-member': 'off',
'eslint-comments/no-unused-disable': 'error'
},
settings: {

View File

@ -9,13 +9,14 @@ const BROWSER_LANGUAGE = computed<string>(
);
const i18n = createI18n({
fallbackLocale: DEFAULT_LANGUAGE,
globalInjection: true,
legacy: false,
locale: Object.keys(messages).includes(BROWSER_LANGUAGE.value)
? BROWSER_LANGUAGE.value
: DEFAULT_LANGUAGE,
fallbackLocale: DEFAULT_LANGUAGE,
messages,
globalInjection: true,
legacy: false
messages
});
export const languageMap = {
@ -30,6 +31,7 @@ export const languageMap = {
eo: 'Esperanto',
es: 'Español',
'es-419': 'Español (América Latina)',
et: 'Eesti keel',
fa: 'فارسی',
fi: 'Suomi',
fil: 'Pilipino',
@ -44,7 +46,9 @@ export const languageMap = {
ko: '한국어',
lt: 'Lietuvių kalba',
ml: 'മലയാളം',
mn: 'Монгол хэл',
ms: 'بهاس ملايو‎',
my: 'မြန်မာဘာသာစကား',
'nb-NO': 'Norsk',
nl: 'Nederlands',
nn: 'Norsk Nynorsk',

View File

@ -0,0 +1,14 @@
export default {
/*
* https://github.com/Spittal/vue-i18n-extract
/*
Required (Glob files pattern)
Do not include the entire src directory because vue-i18n-extract doesn't have a way to exclude directories
*/
vueFiles: './src/{pages,layouts,components}/**/*.vue',
languageFiles: './locales/*.json',
output: false,
add: false,
remove: false,
ci: true
};