From f227ad6e2ff845a58b13456c88e3df23ee35d6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez?= Date: Sat, 14 Jan 2023 11:45:12 +0100 Subject: [PATCH] chore(i18n): fix arabic on top to avoid changing contributing guide (#1088) Co-authored-by: Anthony Fu --- CONTRIBUTING.md | 6 +++--- config/i18n.ts | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99f0edb0..31e43a9d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,9 +93,9 @@ We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://i 1. Add a new file in [locales](./locales) folder with the language code as the filename. 2. Copy [en-US](./locales/en-US.json) and translate the strings. -3. Add the language to the `locales` array in [config/i18n.ts](./config/i18n.ts#L13) -4. If the language is `right-to-left`, add `dir` option with `rtl` value, for example, for [ar-EG](./config/i18n.ts#L79) -5. If the language requires special pluralization rules, add `pluralRule` callback option, for example, for [ar-EG](./config/i18n.ts#L80) +3. Add the language to the `locales` array in [config/i18n.ts](./config/i18n.ts#L12), below `en` variants and `ar-EG`. +4. If the language is `right-to-left`, add `dir` option with `rtl` value, for example, for [ar-EG](./config/i18n.ts#L27) +5. If the language requires special pluralization rules, add `pluralRule` callback option, for example, for [ar-EG](./config/i18n.ts#L27) Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essentials/pluralization.html#custom-pluralization) for more info. diff --git a/config/i18n.ts b/config/i18n.ts index a40ad660..4cab6aa4 100644 --- a/config/i18n.ts +++ b/config/i18n.ts @@ -20,6 +20,16 @@ const locales: LocaleObjectData[] = [ file: 'en-GB.json', name: 'English (UK)', }, + ({ + code: 'ar-EG', + file: 'ar-EG.json', + name: 'العربية', + dir: 'rtl', + pluralRule: (choice: number) => { + const name = new Intl.PluralRules('ar-EG').select(choice) + return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name] + }, + } satisfies LocaleObjectData), { code: 'de-DE', file: 'de-DE.json', @@ -72,16 +82,6 @@ const locales: LocaleObjectData[] = [ file: 'cs-CZ.json', name: 'Česky', }, - ({ - code: 'ar-EG', - file: 'ar-EG.json', - name: 'العربية', - dir: 'rtl', - pluralRule: (choice: number) => { - const name = new Intl.PluralRules('ar-EG').select(choice) - return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name] - }, - } satisfies LocaleObjectData), { code: 'tr-TR', file: 'tr-TR.json',