refactor(i18n): remove variants from en-US and fr-FR

We don't have other variants for those languages, so it makes sense to not make assumptions and use them generically

Signed-off-by: Fernando Fernández <ferferga@hotmail.com>
This commit is contained in:
Fernando Fernández 2024-01-02 13:53:57 +01:00
parent 7cde0c85c8
commit cc6b6eb4b4
No known key found for this signature in database
GPG Key ID: 82FD36644F1F4D3B
8 changed files with 13 additions and 8 deletions

View File

@ -16,7 +16,7 @@
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"i18n-ally.keystyle": "flat",
"i18n-ally.sortKeys": true,
"i18n-ally.sourceLanguage": "en-US",
"i18n-ally.sourceLanguage": "en",
"i18n-ally.localesPaths": [
"frontend/locales"
],

View File

@ -296,12 +296,12 @@ module.exports = {
},
'vue-i18n': {
/**
* We just want to do linting for en-US, weblate already handles removing unused and duplicated keys
* in other locales based on en-US translations!
* We just want to do linting for en, weblate already handles removing unused and duplicated keys
* in other locales based on en translations!
*
* This also allows us to speed up linting
*/
localeDir: 'locales/en-US.json',
localeDir: 'locales/en.json',
messageSyntaxVersion: '^9.0.0'
}
}

View File

@ -72,6 +72,11 @@ for (const e of vuetifyExports) {
const commit_available = !Number(process.env.IS_STABLE) && Boolean(process.env.COMMIT_HASH);
const commit_hash = commit_available && `'${process.env.COMMIT_HASH}'` || undefined;
/**
* Date-fns exports all english locales with variants, so we need to add the match manually
*/
dfnsExports.unshift('enUS as en');
export default {
'virtual:locales/date-fns': `export { ${dfnsExports.join(
', '

View File

@ -6,7 +6,7 @@ import messages from '@intlify/unplugin-vue-i18n/messages';
* See @/store/clientSettings to check where the current user language is initialised
*/
const DEFAULT_LANGUAGE = 'en-US';
const DEFAULT_LANGUAGE = 'en';
export const vuePlugin = createI18n({
fallbackLocale: DEFAULT_LANGUAGE,

View File

@ -3,7 +3,7 @@
*/
export function getLocaleName(
fromCode: string,
toCode = 'en-US'
toCode = 'en'
): string | undefined {
const r = new Intl.DisplayNames([toCode], { type: 'language' }).of(fromCode);

View File

@ -1,4 +1,4 @@
import type enUS from '@/../locales/en-US.json';
import type en from '@/../locales/en.json';
import type { RemotePlugin } from '@/plugins/remote/types';
/**
@ -30,7 +30,7 @@ declare module 'vue' {
}
declare module 'vue-i18n' {
type messages = typeof enUS;
type messages = typeof en;
export interface DefineLocaleMessage extends messages {}
}