chore(i18n): fix arabic on top to avoid changing contributing guide (#1088)

Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
This commit is contained in:
Joaquín Sánchez 2023-01-14 11:45:12 +01:00 committed by GitHub
parent 81e24440e7
commit f227ad6e2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View file

@ -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. 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. 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) 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#L79) 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#L80) 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. Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essentials/pluralization.html#custom-pluralization) for more info.

View file

@ -20,6 +20,16 @@ const locales: LocaleObjectData[] = [
file: 'en-GB.json', file: 'en-GB.json',
name: 'English (UK)', 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', code: 'de-DE',
file: 'de-DE.json', file: 'de-DE.json',
@ -72,16 +82,6 @@ const locales: LocaleObjectData[] = [
file: 'cs-CZ.json', file: 'cs-CZ.json',
name: 'Česky', 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', code: 'tr-TR',
file: 'tr-TR.json', file: 'tr-TR.json',