From 1f13051da3d78ad488119f8e1129b916b1f5a16f Mon Sep 17 00:00:00 2001 From: "Mona,Lisa" Date: Wed, 5 Apr 2023 15:54:16 +0700 Subject: [PATCH 1/7] feat(locale): add additional metadata properties --- docs/guide/localization.md | 16 +++++++-------- src/definitions/metadata.ts | 32 +++++++++++++++++++++++++++++ src/locales/af_ZA/metadata.ts | 8 +++++++- src/locales/ar/metadata.ts | 5 +++++ src/locales/az/metadata.ts | 5 +++++ src/locales/base/metadata.ts | 1 + src/locales/cs_CZ/metadata.ts | 6 ++++++ src/locales/de/metadata.ts | 5 +++++ src/locales/de_AT/metadata.ts | 6 ++++++ src/locales/de_CH/metadata.ts | 6 ++++++ src/locales/dv/metadata.ts | 5 +++++ src/locales/el/metadata.ts | 5 +++++ src/locales/en/metadata.ts | 5 +++++ src/locales/en_AU/metadata.ts | 6 ++++++ src/locales/en_AU_ocker/metadata.ts | 7 +++++++ src/locales/en_BORK/metadata.ts | 6 ++++++ src/locales/en_CA/metadata.ts | 6 ++++++ src/locales/en_GB/metadata.ts | 6 ++++++ src/locales/en_GH/metadata.ts | 6 ++++++ src/locales/en_IE/metadata.ts | 6 ++++++ src/locales/en_IN/metadata.ts | 6 ++++++ src/locales/en_NG/metadata.ts | 6 ++++++ src/locales/en_US/metadata.ts | 6 ++++++ src/locales/en_ZA/metadata.ts | 6 ++++++ src/locales/es/metadata.ts | 5 +++++ src/locales/es_MX/metadata.ts | 6 ++++++ src/locales/fa/metadata.ts | 7 ++++++- src/locales/fi/metadata.ts | 5 +++++ src/locales/fr/metadata.ts | 5 +++++ src/locales/fr_BE/metadata.ts | 6 ++++++ src/locales/fr_CA/metadata.ts | 6 ++++++ src/locales/fr_CH/metadata.ts | 6 ++++++ src/locales/fr_LU/metadata.ts | 6 ++++++ src/locales/he/metadata.ts | 5 +++++ src/locales/hr/metadata.ts | 5 +++++ src/locales/hu/metadata.ts | 5 +++++ src/locales/hy/metadata.ts | 5 +++++ src/locales/id_ID/metadata.ts | 8 +++++++- src/locales/it/metadata.ts | 5 +++++ src/locales/ja/metadata.ts | 5 +++++ src/locales/ka_GE/metadata.ts | 6 ++++++ src/locales/ko/metadata.ts | 5 +++++ src/locales/lv/metadata.ts | 5 +++++ src/locales/mk/metadata.ts | 5 +++++ src/locales/nb_NO/metadata.ts | 8 +++++++- src/locales/ne/metadata.ts | 7 ++++++- src/locales/nl/metadata.ts | 5 +++++ src/locales/nl_BE/metadata.ts | 6 ++++++ src/locales/pl/metadata.ts | 5 +++++ src/locales/pt_BR/metadata.ts | 6 ++++++ src/locales/pt_PT/metadata.ts | 6 ++++++ src/locales/ro/metadata.ts | 5 +++++ src/locales/ru/metadata.ts | 5 +++++ src/locales/sk/metadata.ts | 7 ++++++- src/locales/sr_RS_latin/metadata.ts | 8 +++++++- src/locales/sv/metadata.ts | 5 +++++ src/locales/th/metadata.ts | 5 +++++ src/locales/tr/metadata.ts | 5 +++++ src/locales/uk/metadata.ts | 5 +++++ src/locales/ur/metadata.ts | 5 +++++ src/locales/vi/metadata.ts | 5 +++++ src/locales/zh_CN/metadata.ts | 8 +++++++- src/locales/zh_TW/metadata.ts | 6 ++++++ src/locales/zu_ZA/metadata.ts | 6 ++++++ 64 files changed, 385 insertions(+), 16 deletions(-) diff --git a/docs/guide/localization.md b/docs/guide/localization.md index dcfd7ce35c7..ab2c95912d1 100644 --- a/docs/guide/localization.md +++ b/docs/guide/localization.md @@ -74,7 +74,7 @@ In this example there are 5 locales. Each of these is checked in order, and the | Locale | Name | Faker | | :------------ | :------------------------ | :----------------- | -| `af_ZA` | Afrikaans | `fakerAF_ZA` | +| `af_ZA` | Afrikaans (South Africa) | `fakerAF_ZA` | | `ar` | Arabic | `fakerAR` | | `az` | Azerbaijani | `fakerAZ` | | `base` | Base | `fakerBASE` | @@ -98,7 +98,7 @@ In this example there are 5 locales. Each of these is checked in order, and the | `en_ZA` | English (South Africa) | `fakerEN_ZA` | | `es` | Spanish | `fakerES` | | `es_MX` | Spanish (Mexico) | `fakerES_MX` | -| `fa` | Farsi | `fakerFA` | +| `fa` | Farsi/Persian | `fakerFA` | | `fi` | Finnish | `fakerFI` | | `fr` | French | `fakerFR` | | `fr_BE` | French (Belgium) | `fakerFR_BE` | @@ -109,15 +109,15 @@ In this example there are 5 locales. Each of these is checked in order, and the | `hr` | Croatian | `fakerHR` | | `hu` | Hungarian | `fakerHU` | | `hy` | Armenian | `fakerHY` | -| `id_ID` | Indonesian | `fakerID_ID` | +| `id_ID` | Indonesian (Indonesia) | `fakerID_ID` | | `it` | Italian | `fakerIT` | | `ja` | Japanese | `fakerJA` | | `ka_GE` | Georgian (Georgia) | `fakerKA_GE` | | `ko` | Korean | `fakerKO` | | `lv` | Latvian | `fakerLV` | | `mk` | Macedonian | `fakerMK` | -| `nb_NO` | Norwegian | `fakerNB_NO` | -| `ne` | Nepalese | `fakerNE` | +| `nb_NO` | Norwegian (Norway) | `fakerNB_NO` | +| `ne` | Nepali | `fakerNE` | | `nl` | Dutch | `fakerNL` | | `nl_BE` | Dutch (Belgium) | `fakerNL_BE` | | `pl` | Polish | `fakerPL` | @@ -125,15 +125,15 @@ In this example there are 5 locales. Each of these is checked in order, and the | `pt_PT` | Portuguese (Portugal) | `fakerPT_PT` | | `ro` | Romanian | `fakerRO` | | `ru` | Russian | `fakerRU` | -| `sk` | Slovakian | `fakerSK` | -| `sr_RS_latin` | Serbian (Latin) | `fakerSR_RS_latin` | +| `sk` | Slovak | `fakerSK` | +| `sr_RS_latin` | Serbian (Serbia, Latin) | `fakerSR_RS_latin` | | `sv` | Swedish | `fakerSV` | | `th` | Thai | `fakerTH` | | `tr` | Turkish | `fakerTR` | | `uk` | Ukrainian | `fakerUK` | | `ur` | Urdu | `fakerUR` | | `vi` | Vietnamese | `fakerVI` | -| `zh_CN` | Chinese | `fakerZH_CN` | +| `zh_CN` | Chinese (China) | `fakerZH_CN` | | `zh_TW` | Chinese (Taiwan) | `fakerZH_TW` | | `zu_ZA` | Zulu (South Africa) | `fakerZU_ZA` | diff --git a/src/definitions/metadata.ts b/src/definitions/metadata.ts index 398c2c2abb9..23132c1b264 100644 --- a/src/definitions/metadata.ts +++ b/src/definitions/metadata.ts @@ -3,4 +3,36 @@ export type MetadataDefinitions = { * The English name of the language (and the specific country, if defined). */ title: string; + /** + * The full code of the locale, including the country code if applicable. + */ + code?: string; + /** + * The endonym (native name) of the language (and the specific country, if defined). + * + * @see https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_and_their_capitals_in_native_languages + */ + endonym?: string; + /** + * The ISO 639-1 code of the language. + * + * @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes + */ + language?: string; + /** + * The ISO 3166-1 alpha-2 code of the country. + * + * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 + */ + country?: string; + /** + * Whether the language is written right-to-left. + */ + rtl?: boolean; + /** + * The ISO 15924 code of the script. + * + * @see https://en.wikipedia.org/wiki/ISO_15924 + */ + script?: string; } & Record; diff --git a/src/locales/af_ZA/metadata.ts b/src/locales/af_ZA/metadata.ts index 32120b0054d..0344fba4f87 100644 --- a/src/locales/af_ZA/metadata.ts +++ b/src/locales/af_ZA/metadata.ts @@ -1,7 +1,13 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Afrikaans', + title: 'Afrikaans (South Africa)', + code: 'af_ZA', + country: 'ZA', + language: 'af', + endonym: 'Afrikaans (Suid-Afrika)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/ar/metadata.ts b/src/locales/ar/metadata.ts index f94ccd80fd9..8b4ace9d0ef 100644 --- a/src/locales/ar/metadata.ts +++ b/src/locales/ar/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Arabic', + code: 'ar', + language: 'ar', + endonym: 'اَلْعَرَبِيَّةُ', + rtl: true, + script: 'Arab', }; export default metadata; diff --git a/src/locales/az/metadata.ts b/src/locales/az/metadata.ts index c1360366da1..3f4282a925f 100644 --- a/src/locales/az/metadata.ts +++ b/src/locales/az/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Azerbaijani', + code: 'az', + language: 'az', + endonym: 'azərbaycan dili', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/base/metadata.ts b/src/locales/base/metadata.ts index 888b4d88f26..11369341425 100644 --- a/src/locales/base/metadata.ts +++ b/src/locales/base/metadata.ts @@ -2,6 +2,7 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Base', + code: 'base', }; export default metadata; diff --git a/src/locales/cs_CZ/metadata.ts b/src/locales/cs_CZ/metadata.ts index 98ab47df586..9a688397a06 100644 --- a/src/locales/cs_CZ/metadata.ts +++ b/src/locales/cs_CZ/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Czech (Czechia)', + code: 'cs_CZ', + country: 'CZ', + language: 'cs', + endonym: 'čeština (Česká republika)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/de/metadata.ts b/src/locales/de/metadata.ts index d66b6de10b0..35f7dab66ed 100644 --- a/src/locales/de/metadata.ts +++ b/src/locales/de/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'German', + code: 'de', + language: 'de', + endonym: 'Deutsch', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/de_AT/metadata.ts b/src/locales/de_AT/metadata.ts index db773f7760c..a39af8abfeb 100644 --- a/src/locales/de_AT/metadata.ts +++ b/src/locales/de_AT/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'German (Austria)', + code: 'de_AT', + country: 'AT', + language: 'de', + endonym: 'Deutsch (Österreich)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/de_CH/metadata.ts b/src/locales/de_CH/metadata.ts index 4e462b89bb4..d06b0a70dc6 100644 --- a/src/locales/de_CH/metadata.ts +++ b/src/locales/de_CH/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'German (Switzerland)', + code: 'de_CH', + country: 'CH', + language: 'de', + endonym: 'Deutsch (Schweiz)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/dv/metadata.ts b/src/locales/dv/metadata.ts index d30d10a259e..aa60c4e8985 100644 --- a/src/locales/dv/metadata.ts +++ b/src/locales/dv/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Maldivian', + code: 'dv', + language: 'dv', + endonym: 'ދިވެހި', + rtl: true, + script: 'Thaa', }; export default metadata; diff --git a/src/locales/el/metadata.ts b/src/locales/el/metadata.ts index 17dd91dc55c..1f2fb851ca5 100644 --- a/src/locales/el/metadata.ts +++ b/src/locales/el/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Greek', + code: 'el', + language: 'el', + endonym: 'Ελληνικά', + rtl: false, + script: 'Grek', }; export default metadata; diff --git a/src/locales/en/metadata.ts b/src/locales/en/metadata.ts index 30a936374ae..68d88fb8168 100644 --- a/src/locales/en/metadata.ts +++ b/src/locales/en/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English', + code: 'en', + language: 'en', + endonym: 'English', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_AU/metadata.ts b/src/locales/en_AU/metadata.ts index be925f152af..c5ab5656a96 100644 --- a/src/locales/en_AU/metadata.ts +++ b/src/locales/en_AU/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (Australia)', + code: 'en_AU', + country: 'AU', + language: 'en', + endonym: 'English (Australia)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_AU_ocker/metadata.ts b/src/locales/en_AU_ocker/metadata.ts index b877b114e16..d203c298ab1 100644 --- a/src/locales/en_AU_ocker/metadata.ts +++ b/src/locales/en_AU_ocker/metadata.ts @@ -2,6 +2,13 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (Australia Ocker)', + code: 'en_AU_ocker', + country: 'AU', + language: 'en', + variant: 'ocker', + endonym: 'English (Australia)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_BORK/metadata.ts b/src/locales/en_BORK/metadata.ts index 7349bdca79b..62f9affc7bc 100644 --- a/src/locales/en_BORK/metadata.ts +++ b/src/locales/en_BORK/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (Bork)', + code: 'en_BORK', + variant: 'BORK', + language: 'en', + endonym: 'English (Bork)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_CA/metadata.ts b/src/locales/en_CA/metadata.ts index 40ea4ad07fc..900b8217f14 100644 --- a/src/locales/en_CA/metadata.ts +++ b/src/locales/en_CA/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (Canada)', + code: 'en_CA', + country: 'CA', + language: 'en', + endonym: 'English (Canada)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_GB/metadata.ts b/src/locales/en_GB/metadata.ts index 4007132ea1f..c95e756be5e 100644 --- a/src/locales/en_GB/metadata.ts +++ b/src/locales/en_GB/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (Great Britain)', + code: 'en_GB', + country: 'GB', + language: 'en', + endonym: 'English (Great Britain)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_GH/metadata.ts b/src/locales/en_GH/metadata.ts index 9bd30240c2f..3e30a6bc9eb 100644 --- a/src/locales/en_GH/metadata.ts +++ b/src/locales/en_GH/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (Ghana)', + code: 'en_GH', + country: 'GH', + language: 'en', + endonym: 'English (Ghana)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_IE/metadata.ts b/src/locales/en_IE/metadata.ts index 765b371c3f8..3f2be551661 100644 --- a/src/locales/en_IE/metadata.ts +++ b/src/locales/en_IE/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (Ireland)', + code: 'en_IE', + country: 'IE', + language: 'en', + endonym: 'English (Ireland)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_IN/metadata.ts b/src/locales/en_IN/metadata.ts index dd7ce2ca2ed..cb59e111eac 100644 --- a/src/locales/en_IN/metadata.ts +++ b/src/locales/en_IN/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (India)', + code: 'en_IN', + country: 'IN', + language: 'en', + endonym: 'English (India)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_NG/metadata.ts b/src/locales/en_NG/metadata.ts index fed81e3fd54..e428a62a157 100644 --- a/src/locales/en_NG/metadata.ts +++ b/src/locales/en_NG/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (Nigeria)', + code: 'en_NG', + country: 'NG', + language: 'en', + endonym: 'English (Nigeria)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_US/metadata.ts b/src/locales/en_US/metadata.ts index c08c0170734..152906bb014 100644 --- a/src/locales/en_US/metadata.ts +++ b/src/locales/en_US/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (United States)', + code: 'en_US', + country: 'US', + language: 'en', + endonym: 'English (United States)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_ZA/metadata.ts b/src/locales/en_ZA/metadata.ts index dbca3b102a1..822c31312d3 100644 --- a/src/locales/en_ZA/metadata.ts +++ b/src/locales/en_ZA/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'English (South Africa)', + code: 'en_ZA', + country: 'ZA', + language: 'en', + endonym: 'English (South Africa)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/es/metadata.ts b/src/locales/es/metadata.ts index b6c6cf19068..ca13e93d0c9 100644 --- a/src/locales/es/metadata.ts +++ b/src/locales/es/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Spanish', + code: 'es', + language: 'es', + endonym: 'Español', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/es_MX/metadata.ts b/src/locales/es_MX/metadata.ts index 540895d68e3..760234d6875 100644 --- a/src/locales/es_MX/metadata.ts +++ b/src/locales/es_MX/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Spanish (Mexico)', + code: 'es_MX', + country: 'MX', + language: 'es', + endonym: 'Español (México)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/fa/metadata.ts b/src/locales/fa/metadata.ts index 0fc4f55cf17..24d5d4b07f3 100644 --- a/src/locales/fa/metadata.ts +++ b/src/locales/fa/metadata.ts @@ -1,7 +1,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Farsi', + title: 'Farsi/Persian', + code: 'fa', + language: 'fa', + endonym: 'فارسی', + rtl: true, + script: 'Arab', }; export default metadata; diff --git a/src/locales/fi/metadata.ts b/src/locales/fi/metadata.ts index 08115a1ace3..7138249de78 100644 --- a/src/locales/fi/metadata.ts +++ b/src/locales/fi/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Finnish', + code: 'fi', + language: 'fi', + endonym: 'suomi', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr/metadata.ts b/src/locales/fr/metadata.ts index 45f83699022..0b0b3dc60e8 100644 --- a/src/locales/fr/metadata.ts +++ b/src/locales/fr/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'French', + code: 'fr', + language: 'fr', + endonym: 'Français', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr_BE/metadata.ts b/src/locales/fr_BE/metadata.ts index 87a70b2773b..c5c185fb50c 100644 --- a/src/locales/fr_BE/metadata.ts +++ b/src/locales/fr_BE/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'French (Belgium)', + code: 'fr_BE', + country: 'BE', + language: 'fr', + endonym: 'Français (Belgique)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr_CA/metadata.ts b/src/locales/fr_CA/metadata.ts index 306b3296f2f..df1cb34d633 100644 --- a/src/locales/fr_CA/metadata.ts +++ b/src/locales/fr_CA/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'French (Canada)', + code: 'fr_CA', + country: 'CA', + language: 'fr', + endonym: 'Français (Canada)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr_CH/metadata.ts b/src/locales/fr_CH/metadata.ts index 5b191b8161b..f9b4e09d38b 100644 --- a/src/locales/fr_CH/metadata.ts +++ b/src/locales/fr_CH/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'French (Switzerland)', + code: 'fr_CH', + country: 'CH', + language: 'fr', + endonym: 'Français (Suisse)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr_LU/metadata.ts b/src/locales/fr_LU/metadata.ts index 79da9cef665..bf2c0cf5858 100644 --- a/src/locales/fr_LU/metadata.ts +++ b/src/locales/fr_LU/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'French (Luxembourg)', + code: 'fr_LU', + country: 'LU', + language: 'fr', + endonym: 'Français (Luxembourg)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/he/metadata.ts b/src/locales/he/metadata.ts index e816e529835..2f3373674e6 100644 --- a/src/locales/he/metadata.ts +++ b/src/locales/he/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Hebrew', + code: 'he', + language: 'he', + endonym: 'עברית', + rtl: true, + script: 'Hebr', }; export default metadata; diff --git a/src/locales/hr/metadata.ts b/src/locales/hr/metadata.ts index bc95cdaadac..90d5622ea06 100644 --- a/src/locales/hr/metadata.ts +++ b/src/locales/hr/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Croatian', + code: 'hr', + language: 'hr', + endonym: 'Hrvatski', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/hu/metadata.ts b/src/locales/hu/metadata.ts index 8602d9a0117..18b368238f1 100644 --- a/src/locales/hu/metadata.ts +++ b/src/locales/hu/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Hungarian', + code: 'hu', + language: 'hu', + endonym: 'magyar', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/hy/metadata.ts b/src/locales/hy/metadata.ts index c20110c1501..f9ab709561f 100644 --- a/src/locales/hy/metadata.ts +++ b/src/locales/hy/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Armenian', + code: 'hy', + language: 'hy', + endonym: 'Հայերեն', + rtl: false, + script: 'Armn', }; export default metadata; diff --git a/src/locales/id_ID/metadata.ts b/src/locales/id_ID/metadata.ts index 73df9ea4eaa..4b2b3d599f0 100644 --- a/src/locales/id_ID/metadata.ts +++ b/src/locales/id_ID/metadata.ts @@ -1,7 +1,13 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Indonesian', + title: 'Indonesian (Indonesia)', + code: 'id_ID', + country: 'ID', + language: 'id', + endonym: 'Bahasa Indonesia (Indonesia)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/it/metadata.ts b/src/locales/it/metadata.ts index 78e7e2ee2fe..b9442eb64b8 100644 --- a/src/locales/it/metadata.ts +++ b/src/locales/it/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Italian', + code: 'it', + language: 'it', + endonym: 'Italiano', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/ja/metadata.ts b/src/locales/ja/metadata.ts index e1f2e3a22f2..14e117a81a0 100644 --- a/src/locales/ja/metadata.ts +++ b/src/locales/ja/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Japanese', + code: 'ja', + language: 'ja', + endonym: '日本語', + rtl: false, + script: 'Jpan', }; export default metadata; diff --git a/src/locales/ka_GE/metadata.ts b/src/locales/ka_GE/metadata.ts index 5a049913438..4072eefa853 100644 --- a/src/locales/ka_GE/metadata.ts +++ b/src/locales/ka_GE/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Georgian (Georgia)', + code: 'ka_GE', + country: 'GE', + language: 'ka', + endonym: 'ქართული (საქართველო)', + rtl: false, + script: 'Geor', }; export default metadata; diff --git a/src/locales/ko/metadata.ts b/src/locales/ko/metadata.ts index f5343b2fd45..46ba9558963 100644 --- a/src/locales/ko/metadata.ts +++ b/src/locales/ko/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Korean', + code: 'ko', + language: 'ko', + endonym: '한국어', + rtl: false, + script: 'Kore', }; export default metadata; diff --git a/src/locales/lv/metadata.ts b/src/locales/lv/metadata.ts index 60b0cf2f012..b3b02d65a31 100644 --- a/src/locales/lv/metadata.ts +++ b/src/locales/lv/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Latvian', + code: 'lv', + language: 'lv', + endonym: 'latviešu valoda', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/mk/metadata.ts b/src/locales/mk/metadata.ts index 6c564a10f8f..fc659f148c2 100644 --- a/src/locales/mk/metadata.ts +++ b/src/locales/mk/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Macedonian', + code: 'mk', + language: 'mk', + endonym: 'македонски јазик', + rtl: false, + script: 'Cyrl', }; export default metadata; diff --git a/src/locales/nb_NO/metadata.ts b/src/locales/nb_NO/metadata.ts index 5037872f442..5f2e9065cb7 100644 --- a/src/locales/nb_NO/metadata.ts +++ b/src/locales/nb_NO/metadata.ts @@ -1,7 +1,13 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Norwegian', + title: 'Norwegian (Norway)', + code: 'nb_NO', + country: 'NO', + language: 'nb', + endonym: 'Norsk bokmål (Norge)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/ne/metadata.ts b/src/locales/ne/metadata.ts index 8b3043c6506..4773dc6e287 100644 --- a/src/locales/ne/metadata.ts +++ b/src/locales/ne/metadata.ts @@ -1,7 +1,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Nepalese', + title: 'Nepali', + code: 'ne', + language: 'ne', + endonym: 'नेपाली', + rtl: false, + script: 'Deva', }; export default metadata; diff --git a/src/locales/nl/metadata.ts b/src/locales/nl/metadata.ts index d69a9a2f948..2f20302e880 100644 --- a/src/locales/nl/metadata.ts +++ b/src/locales/nl/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Dutch', + code: 'nl', + language: 'nl', + endonym: 'Nederlands', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/nl_BE/metadata.ts b/src/locales/nl_BE/metadata.ts index 6da791a1f2d..7147811e1f4 100644 --- a/src/locales/nl_BE/metadata.ts +++ b/src/locales/nl_BE/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Dutch (Belgium)', + code: 'nl_BE', + country: 'BE', + language: 'nl', + endonym: 'Nederlands (België)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/pl/metadata.ts b/src/locales/pl/metadata.ts index fb70cd86c9d..5ab6c1ff640 100644 --- a/src/locales/pl/metadata.ts +++ b/src/locales/pl/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Polish', + code: 'pl', + language: 'pl', + endonym: 'Polski', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/pt_BR/metadata.ts b/src/locales/pt_BR/metadata.ts index 0ef5efd87f0..84e15d34dc8 100644 --- a/src/locales/pt_BR/metadata.ts +++ b/src/locales/pt_BR/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Portuguese (Brazil)', + code: 'pt_BR', + country: 'BR', + language: 'pt', + endonym: 'Português (Brasil)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/pt_PT/metadata.ts b/src/locales/pt_PT/metadata.ts index 020f3bbd4d5..ef76ba5c6f9 100644 --- a/src/locales/pt_PT/metadata.ts +++ b/src/locales/pt_PT/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Portuguese (Portugal)', + code: 'pt_PT', + country: 'PT', + language: 'pt', + endonym: 'Português (Portugal)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/ro/metadata.ts b/src/locales/ro/metadata.ts index 711017cf4d8..436abe10263 100644 --- a/src/locales/ro/metadata.ts +++ b/src/locales/ro/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Romanian', + code: 'ro', + language: 'ro', + endonym: 'Română', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/ru/metadata.ts b/src/locales/ru/metadata.ts index de20840d2b5..80fdfe618b5 100644 --- a/src/locales/ru/metadata.ts +++ b/src/locales/ru/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Russian', + code: 'ru', + language: 'ru', + endonym: 'Русский', + rtl: false, + script: 'Cyrl', }; export default metadata; diff --git a/src/locales/sk/metadata.ts b/src/locales/sk/metadata.ts index 88e8fee4171..7ca5003e1aa 100644 --- a/src/locales/sk/metadata.ts +++ b/src/locales/sk/metadata.ts @@ -1,7 +1,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Slovakian', + title: 'Slovak', + code: 'sk', + language: 'sk', + endonym: 'slovenčina', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/sr_RS_latin/metadata.ts b/src/locales/sr_RS_latin/metadata.ts index 1491476cd05..e2a809a1757 100644 --- a/src/locales/sr_RS_latin/metadata.ts +++ b/src/locales/sr_RS_latin/metadata.ts @@ -1,7 +1,13 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Serbian (Latin)', + title: 'Serbian (Serbia, Latin)', + code: 'sr_RS_latin', + country: 'RS', + language: 'sr', + endonym: 'srpski (Srbija, latinica)', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/sv/metadata.ts b/src/locales/sv/metadata.ts index 42fe6a4afbc..07a8e5ce30e 100644 --- a/src/locales/sv/metadata.ts +++ b/src/locales/sv/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Swedish', + code: 'sv', + language: 'sv', + endonym: 'Svenska', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/th/metadata.ts b/src/locales/th/metadata.ts index 373affbd0b8..82ebd1cb4c7 100644 --- a/src/locales/th/metadata.ts +++ b/src/locales/th/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Thai', + code: 'th', + language: 'th', + endonym: 'ไทย', + rtl: false, + script: 'Thai', }; export default metadata; diff --git a/src/locales/tr/metadata.ts b/src/locales/tr/metadata.ts index 8d914062f1a..0eb86f13876 100644 --- a/src/locales/tr/metadata.ts +++ b/src/locales/tr/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Turkish', + code: 'tr', + language: 'tr', + endonym: 'Türkçe', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/uk/metadata.ts b/src/locales/uk/metadata.ts index e2d58ed341f..c68fe383616 100644 --- a/src/locales/uk/metadata.ts +++ b/src/locales/uk/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Ukrainian', + code: 'uk', + language: 'uk', + endonym: 'Українська', + rtl: false, + script: 'Cyrl', }; export default metadata; diff --git a/src/locales/ur/metadata.ts b/src/locales/ur/metadata.ts index b0610eceb55..09d4e0f0247 100644 --- a/src/locales/ur/metadata.ts +++ b/src/locales/ur/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Urdu', + code: 'ur', + language: 'ur', + endonym: 'اردو', + rtl: true, + script: 'Arab', }; export default metadata; diff --git a/src/locales/vi/metadata.ts b/src/locales/vi/metadata.ts index 4d8e01f00a8..b78eb4eea8d 100644 --- a/src/locales/vi/metadata.ts +++ b/src/locales/vi/metadata.ts @@ -2,6 +2,11 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Vietnamese', + code: 'vi', + language: 'vi', + endonym: 'Tiếng Việt', + rtl: false, + script: 'Latn', }; export default metadata; diff --git a/src/locales/zh_CN/metadata.ts b/src/locales/zh_CN/metadata.ts index ad2dc1a3235..4dc42310e2a 100644 --- a/src/locales/zh_CN/metadata.ts +++ b/src/locales/zh_CN/metadata.ts @@ -1,7 +1,13 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { - title: 'Chinese', + title: 'Chinese (China)', + code: 'zh_CN', + country: 'CN', + language: 'zh', + endonym: '中文 (中国)', + rtl: false, + script: 'Hans', }; export default metadata; diff --git a/src/locales/zh_TW/metadata.ts b/src/locales/zh_TW/metadata.ts index 54e15cac9bf..1d78cf2e570 100644 --- a/src/locales/zh_TW/metadata.ts +++ b/src/locales/zh_TW/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Chinese (Taiwan)', + code: 'zh_TW', + country: 'TW', + language: 'zh', + endonym: '中文 (臺灣)', + rtl: false, + script: 'Hant', }; export default metadata; diff --git a/src/locales/zu_ZA/metadata.ts b/src/locales/zu_ZA/metadata.ts index 3e30c09d5a8..76f9d163a75 100644 --- a/src/locales/zu_ZA/metadata.ts +++ b/src/locales/zu_ZA/metadata.ts @@ -2,6 +2,12 @@ import type { MetadataDefinitions } from '../..'; const metadata: MetadataDefinitions = { title: 'Zulu (South Africa)', + code: 'zu_ZA', + country: 'ZA', + language: 'zu', + endonym: 'isiZulu (Iningizimu Afrika)', + rtl: false, + script: 'Latn', }; export default metadata; From 497ff9fc76f9f1b911e40de77ef6f2aa55883b77 Mon Sep 17 00:00:00 2001 From: "Mona,Lisa" Date: Wed, 5 Apr 2023 17:11:31 +0700 Subject: [PATCH 2/7] add some tests --- test/locale-imports.spec.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/locale-imports.spec.ts b/test/locale-imports.spec.ts index bfe639eca0b..6662e035b53 100644 --- a/test/locale-imports.spec.ts +++ b/test/locale-imports.spec.ts @@ -29,6 +29,40 @@ describe('locale imports', () => { ); }); + it(`should have complete metadata values`, () => { + const metadata = allLocales[locale].metadata; + expect(metadata.title).toBeTypeOf('string'); + expect(metadata.code).toBeTypeOf('string'); + expect(metadata.code).toEqual(locale); + if (locale !== 'base') { + expect(metadata.language).toBeTypeOf('string'); + expect(metadata.language).toMatch(/^[a-z]{2}$/); + expect(metadata.script).toBeTypeOf('string'); + expect([ + 'Arab', + 'Armn', + 'Cyrl', + 'Deva', + 'Geor', + 'Grek', + 'Hans', + 'Hant', + 'Hebr', + 'Jpan', + 'Kore', + 'Latn', + 'Thaa', + 'Thai', + ]).toContain(metadata.script); + expect(metadata.endonym).toBeTypeOf('string'); + expect(metadata.rtl).toBeTypeOf('boolean'); + if (metadata.country) { + expect(metadata.country).toBeTypeOf('string'); + expect(metadata.country).toMatch(/^[A-Z]{2}$/); + } + } + }); + describe('Internal tests to cover `src/locale/*.ts`', () => { it(`should be possible to directly require('../locale/${locale}')`, () => { // eslint-disable-next-line @typescript-eslint/no-var-requires From 9ec13816e552cd32a981d5b836b4cb95935d824d Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 5 Apr 2023 21:05:38 +0200 Subject: [PATCH 3/7] chore: ST-DDT's suggestions --- src/definitions/definitions.ts | 2 +- src/definitions/metadata.ts | 44 +++++++++++++++++++++-------- src/locales/af_ZA/metadata.ts | 4 +-- src/locales/ar/metadata.ts | 4 +-- src/locales/az/metadata.ts | 4 +-- src/locales/cs_CZ/metadata.ts | 4 +-- src/locales/de/metadata.ts | 4 +-- src/locales/de_AT/metadata.ts | 4 +-- src/locales/de_CH/metadata.ts | 4 +-- src/locales/dv/metadata.ts | 4 +-- src/locales/el/metadata.ts | 4 +-- src/locales/en/metadata.ts | 4 +-- src/locales/en_AU/metadata.ts | 4 +-- src/locales/en_AU_ocker/metadata.ts | 4 +-- src/locales/en_BORK/metadata.ts | 4 +-- src/locales/en_CA/metadata.ts | 4 +-- src/locales/en_GB/metadata.ts | 4 +-- src/locales/en_GH/metadata.ts | 4 +-- src/locales/en_IE/metadata.ts | 4 +-- src/locales/en_IN/metadata.ts | 4 +-- src/locales/en_NG/metadata.ts | 4 +-- src/locales/en_US/metadata.ts | 4 +-- src/locales/en_ZA/metadata.ts | 4 +-- src/locales/es/metadata.ts | 4 +-- src/locales/es_MX/metadata.ts | 4 +-- src/locales/fa/metadata.ts | 4 +-- src/locales/fi/metadata.ts | 4 +-- src/locales/fr/metadata.ts | 4 +-- src/locales/fr_BE/metadata.ts | 4 +-- src/locales/fr_CA/metadata.ts | 4 +-- src/locales/fr_CH/metadata.ts | 4 +-- src/locales/fr_LU/metadata.ts | 4 +-- src/locales/he/metadata.ts | 4 +-- src/locales/hr/metadata.ts | 4 +-- src/locales/hu/metadata.ts | 4 +-- src/locales/hy/metadata.ts | 4 +-- src/locales/id_ID/metadata.ts | 4 +-- src/locales/it/metadata.ts | 4 +-- src/locales/ja/metadata.ts | 4 +-- src/locales/ka_GE/metadata.ts | 4 +-- src/locales/ko/metadata.ts | 4 +-- src/locales/lv/metadata.ts | 4 +-- src/locales/mk/metadata.ts | 4 +-- src/locales/nb_NO/metadata.ts | 4 +-- src/locales/ne/metadata.ts | 4 +-- src/locales/nl/metadata.ts | 4 +-- src/locales/nl_BE/metadata.ts | 4 +-- src/locales/pl/metadata.ts | 4 +-- src/locales/pt_BR/metadata.ts | 4 +-- src/locales/pt_PT/metadata.ts | 4 +-- src/locales/ro/metadata.ts | 4 +-- src/locales/ru/metadata.ts | 4 +-- src/locales/sk/metadata.ts | 4 +-- src/locales/sr_RS_latin/metadata.ts | 4 +-- src/locales/sv/metadata.ts | 4 +-- src/locales/th/metadata.ts | 4 +-- src/locales/tr/metadata.ts | 4 +-- src/locales/uk/metadata.ts | 4 +-- src/locales/ur/metadata.ts | 4 +-- src/locales/vi/metadata.ts | 4 +-- src/locales/zh_CN/metadata.ts | 4 +-- src/locales/zh_TW/metadata.ts | 4 +-- src/locales/zu_ZA/metadata.ts | 4 +-- src/utils/merge-locales.ts | 2 +- 64 files changed, 157 insertions(+), 135 deletions(-) diff --git a/src/definitions/definitions.ts b/src/definitions/definitions.ts index 112c2c1aa64..dd477bebcba 100644 --- a/src/definitions/definitions.ts +++ b/src/definitions/definitions.ts @@ -32,7 +32,7 @@ export type LocaleEntry> = Partial & * that most properties are optional and extra properties are allowed. */ export type LocaleDefinition = { - metadata: MetadataDefinitions; + metadata?: MetadataDefinitions; airline?: AirlineDefinitions; animal?: AnimalDefinitions; color?: ColorDefinitions; diff --git a/src/definitions/metadata.ts b/src/definitions/metadata.ts index 23132c1b264..f70427201de 100644 --- a/src/definitions/metadata.ts +++ b/src/definitions/metadata.ts @@ -1,4 +1,9 @@ -export type MetadataDefinitions = { +import type { LocaleEntry } from './definitions'; + +/** + * Metadata for pre-built locales. + */ +export type PreBuiltMetadataDefinitions = { /** * The English name of the language (and the specific country, if defined). */ @@ -6,33 +11,50 @@ export type MetadataDefinitions = { /** * The full code of the locale, including the country code if applicable. */ - code?: string; + code: string; /** * The endonym (native name) of the language (and the specific country, if defined). * * @see https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_and_their_capitals_in_native_languages */ - endonym?: string; + endonym: string; /** * The ISO 639-1 code of the language. * * @see https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes */ - language?: string; + language: string; /** - * The ISO 3166-1 alpha-2 code of the country. - * - * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 + * The specific variant of the language. This usually refers to a dialect or slang. */ - country?: string; + variant?: string; /** * Whether the language is written right-to-left. */ - rtl?: boolean; + rtl: boolean; /** * The ISO 15924 code of the script. * * @see https://en.wikipedia.org/wiki/ISO_15924 */ - script?: string; -} & Record; + script: string; +}; + +/** + * Metadata for pre-built locales for a specific country. + */ +export type PreBuiltMetadataDefinitionsForCountry = + PreBuiltMetadataDefinitions & { + /** + * The ISO 3166-1 alpha-2 code of the country. + * + * @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 + */ + country: string; + }; + +/** + * Metadata for the current locale. + */ +export type MetadataDefinitions = + LocaleEntry; diff --git a/src/locales/af_ZA/metadata.ts b/src/locales/af_ZA/metadata.ts index 0344fba4f87..892570cf8a2 100644 --- a/src/locales/af_ZA/metadata.ts +++ b/src/locales/af_ZA/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Afrikaans (South Africa)', code: 'af_ZA', country: 'ZA', diff --git a/src/locales/ar/metadata.ts b/src/locales/ar/metadata.ts index 8b4ace9d0ef..3623b1e4b2e 100644 --- a/src/locales/ar/metadata.ts +++ b/src/locales/ar/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Arabic', code: 'ar', language: 'ar', diff --git a/src/locales/az/metadata.ts b/src/locales/az/metadata.ts index 3f4282a925f..62851968a7f 100644 --- a/src/locales/az/metadata.ts +++ b/src/locales/az/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Azerbaijani', code: 'az', language: 'az', diff --git a/src/locales/cs_CZ/metadata.ts b/src/locales/cs_CZ/metadata.ts index 9a688397a06..77b30a4d67f 100644 --- a/src/locales/cs_CZ/metadata.ts +++ b/src/locales/cs_CZ/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Czech (Czechia)', code: 'cs_CZ', country: 'CZ', diff --git a/src/locales/de/metadata.ts b/src/locales/de/metadata.ts index 35f7dab66ed..ac914dd0313 100644 --- a/src/locales/de/metadata.ts +++ b/src/locales/de/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'German', code: 'de', language: 'de', diff --git a/src/locales/de_AT/metadata.ts b/src/locales/de_AT/metadata.ts index a39af8abfeb..aefdf311480 100644 --- a/src/locales/de_AT/metadata.ts +++ b/src/locales/de_AT/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'German (Austria)', code: 'de_AT', country: 'AT', diff --git a/src/locales/de_CH/metadata.ts b/src/locales/de_CH/metadata.ts index d06b0a70dc6..5d5f5f950d3 100644 --- a/src/locales/de_CH/metadata.ts +++ b/src/locales/de_CH/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'German (Switzerland)', code: 'de_CH', country: 'CH', diff --git a/src/locales/dv/metadata.ts b/src/locales/dv/metadata.ts index aa60c4e8985..981955246ac 100644 --- a/src/locales/dv/metadata.ts +++ b/src/locales/dv/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Maldivian', code: 'dv', language: 'dv', diff --git a/src/locales/el/metadata.ts b/src/locales/el/metadata.ts index 1f2fb851ca5..d015ddbf0f9 100644 --- a/src/locales/el/metadata.ts +++ b/src/locales/el/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Greek', code: 'el', language: 'el', diff --git a/src/locales/en/metadata.ts b/src/locales/en/metadata.ts index 68d88fb8168..cb9844bc44b 100644 --- a/src/locales/en/metadata.ts +++ b/src/locales/en/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'English', code: 'en', language: 'en', diff --git a/src/locales/en_AU/metadata.ts b/src/locales/en_AU/metadata.ts index c5ab5656a96..d8912059221 100644 --- a/src/locales/en_AU/metadata.ts +++ b/src/locales/en_AU/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Australia)', code: 'en_AU', country: 'AU', diff --git a/src/locales/en_AU_ocker/metadata.ts b/src/locales/en_AU_ocker/metadata.ts index d203c298ab1..c6133bd6e42 100644 --- a/src/locales/en_AU_ocker/metadata.ts +++ b/src/locales/en_AU_ocker/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Australia Ocker)', code: 'en_AU_ocker', country: 'AU', diff --git a/src/locales/en_BORK/metadata.ts b/src/locales/en_BORK/metadata.ts index 62f9affc7bc..61e08a90b8e 100644 --- a/src/locales/en_BORK/metadata.ts +++ b/src/locales/en_BORK/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'English (Bork)', code: 'en_BORK', variant: 'BORK', diff --git a/src/locales/en_CA/metadata.ts b/src/locales/en_CA/metadata.ts index 900b8217f14..d528514b8c7 100644 --- a/src/locales/en_CA/metadata.ts +++ b/src/locales/en_CA/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Canada)', code: 'en_CA', country: 'CA', diff --git a/src/locales/en_GB/metadata.ts b/src/locales/en_GB/metadata.ts index c95e756be5e..5b37fb6bdf8 100644 --- a/src/locales/en_GB/metadata.ts +++ b/src/locales/en_GB/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Great Britain)', code: 'en_GB', country: 'GB', diff --git a/src/locales/en_GH/metadata.ts b/src/locales/en_GH/metadata.ts index 3e30a6bc9eb..7a79a96fd9d 100644 --- a/src/locales/en_GH/metadata.ts +++ b/src/locales/en_GH/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Ghana)', code: 'en_GH', country: 'GH', diff --git a/src/locales/en_IE/metadata.ts b/src/locales/en_IE/metadata.ts index 3f2be551661..582986ba848 100644 --- a/src/locales/en_IE/metadata.ts +++ b/src/locales/en_IE/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Ireland)', code: 'en_IE', country: 'IE', diff --git a/src/locales/en_IN/metadata.ts b/src/locales/en_IN/metadata.ts index cb59e111eac..a274fdcd911 100644 --- a/src/locales/en_IN/metadata.ts +++ b/src/locales/en_IN/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (India)', code: 'en_IN', country: 'IN', diff --git a/src/locales/en_NG/metadata.ts b/src/locales/en_NG/metadata.ts index e428a62a157..6cd220b2d39 100644 --- a/src/locales/en_NG/metadata.ts +++ b/src/locales/en_NG/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Nigeria)', code: 'en_NG', country: 'NG', diff --git a/src/locales/en_US/metadata.ts b/src/locales/en_US/metadata.ts index 152906bb014..9932bac29e3 100644 --- a/src/locales/en_US/metadata.ts +++ b/src/locales/en_US/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (United States)', code: 'en_US', country: 'US', diff --git a/src/locales/en_ZA/metadata.ts b/src/locales/en_ZA/metadata.ts index 822c31312d3..303b181922b 100644 --- a/src/locales/en_ZA/metadata.ts +++ b/src/locales/en_ZA/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (South Africa)', code: 'en_ZA', country: 'ZA', diff --git a/src/locales/es/metadata.ts b/src/locales/es/metadata.ts index ca13e93d0c9..b2b99581989 100644 --- a/src/locales/es/metadata.ts +++ b/src/locales/es/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Spanish', code: 'es', language: 'es', diff --git a/src/locales/es_MX/metadata.ts b/src/locales/es_MX/metadata.ts index 760234d6875..90cb1d2b348 100644 --- a/src/locales/es_MX/metadata.ts +++ b/src/locales/es_MX/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Spanish (Mexico)', code: 'es_MX', country: 'MX', diff --git a/src/locales/fa/metadata.ts b/src/locales/fa/metadata.ts index 24d5d4b07f3..5488397edec 100644 --- a/src/locales/fa/metadata.ts +++ b/src/locales/fa/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Farsi/Persian', code: 'fa', language: 'fa', diff --git a/src/locales/fi/metadata.ts b/src/locales/fi/metadata.ts index 7138249de78..9b20a3b1c82 100644 --- a/src/locales/fi/metadata.ts +++ b/src/locales/fi/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Finnish', code: 'fi', language: 'fi', diff --git a/src/locales/fr/metadata.ts b/src/locales/fr/metadata.ts index 0b0b3dc60e8..6afeb2dc209 100644 --- a/src/locales/fr/metadata.ts +++ b/src/locales/fr/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'French', code: 'fr', language: 'fr', diff --git a/src/locales/fr_BE/metadata.ts b/src/locales/fr_BE/metadata.ts index c5c185fb50c..6302b0f492c 100644 --- a/src/locales/fr_BE/metadata.ts +++ b/src/locales/fr_BE/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'French (Belgium)', code: 'fr_BE', country: 'BE', diff --git a/src/locales/fr_CA/metadata.ts b/src/locales/fr_CA/metadata.ts index df1cb34d633..9d8b185303f 100644 --- a/src/locales/fr_CA/metadata.ts +++ b/src/locales/fr_CA/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'French (Canada)', code: 'fr_CA', country: 'CA', diff --git a/src/locales/fr_CH/metadata.ts b/src/locales/fr_CH/metadata.ts index f9b4e09d38b..b51ab74b835 100644 --- a/src/locales/fr_CH/metadata.ts +++ b/src/locales/fr_CH/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'French (Switzerland)', code: 'fr_CH', country: 'CH', diff --git a/src/locales/fr_LU/metadata.ts b/src/locales/fr_LU/metadata.ts index bf2c0cf5858..3ddfcde770c 100644 --- a/src/locales/fr_LU/metadata.ts +++ b/src/locales/fr_LU/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'French (Luxembourg)', code: 'fr_LU', country: 'LU', diff --git a/src/locales/he/metadata.ts b/src/locales/he/metadata.ts index 2f3373674e6..6ed4091b387 100644 --- a/src/locales/he/metadata.ts +++ b/src/locales/he/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Hebrew', code: 'he', language: 'he', diff --git a/src/locales/hr/metadata.ts b/src/locales/hr/metadata.ts index 90d5622ea06..b0477ebc86f 100644 --- a/src/locales/hr/metadata.ts +++ b/src/locales/hr/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Croatian', code: 'hr', language: 'hr', diff --git a/src/locales/hu/metadata.ts b/src/locales/hu/metadata.ts index 18b368238f1..2db99443514 100644 --- a/src/locales/hu/metadata.ts +++ b/src/locales/hu/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Hungarian', code: 'hu', language: 'hu', diff --git a/src/locales/hy/metadata.ts b/src/locales/hy/metadata.ts index f9ab709561f..666bee3d8bd 100644 --- a/src/locales/hy/metadata.ts +++ b/src/locales/hy/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Armenian', code: 'hy', language: 'hy', diff --git a/src/locales/id_ID/metadata.ts b/src/locales/id_ID/metadata.ts index 4b2b3d599f0..114a1db4f23 100644 --- a/src/locales/id_ID/metadata.ts +++ b/src/locales/id_ID/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Indonesian (Indonesia)', code: 'id_ID', country: 'ID', diff --git a/src/locales/it/metadata.ts b/src/locales/it/metadata.ts index b9442eb64b8..a23ea0bfb67 100644 --- a/src/locales/it/metadata.ts +++ b/src/locales/it/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Italian', code: 'it', language: 'it', diff --git a/src/locales/ja/metadata.ts b/src/locales/ja/metadata.ts index 14e117a81a0..386c9c7b800 100644 --- a/src/locales/ja/metadata.ts +++ b/src/locales/ja/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Japanese', code: 'ja', language: 'ja', diff --git a/src/locales/ka_GE/metadata.ts b/src/locales/ka_GE/metadata.ts index 4072eefa853..1df7aa76d0d 100644 --- a/src/locales/ka_GE/metadata.ts +++ b/src/locales/ka_GE/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Georgian (Georgia)', code: 'ka_GE', country: 'GE', diff --git a/src/locales/ko/metadata.ts b/src/locales/ko/metadata.ts index 46ba9558963..16413342172 100644 --- a/src/locales/ko/metadata.ts +++ b/src/locales/ko/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Korean', code: 'ko', language: 'ko', diff --git a/src/locales/lv/metadata.ts b/src/locales/lv/metadata.ts index b3b02d65a31..3e875fda5ce 100644 --- a/src/locales/lv/metadata.ts +++ b/src/locales/lv/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Latvian', code: 'lv', language: 'lv', diff --git a/src/locales/mk/metadata.ts b/src/locales/mk/metadata.ts index fc659f148c2..4d1cc7493f9 100644 --- a/src/locales/mk/metadata.ts +++ b/src/locales/mk/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Macedonian', code: 'mk', language: 'mk', diff --git a/src/locales/nb_NO/metadata.ts b/src/locales/nb_NO/metadata.ts index 5f2e9065cb7..3848d5d369a 100644 --- a/src/locales/nb_NO/metadata.ts +++ b/src/locales/nb_NO/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Norwegian (Norway)', code: 'nb_NO', country: 'NO', diff --git a/src/locales/ne/metadata.ts b/src/locales/ne/metadata.ts index 4773dc6e287..57d978dc14c 100644 --- a/src/locales/ne/metadata.ts +++ b/src/locales/ne/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Nepali', code: 'ne', language: 'ne', diff --git a/src/locales/nl/metadata.ts b/src/locales/nl/metadata.ts index 2f20302e880..7a3a178149f 100644 --- a/src/locales/nl/metadata.ts +++ b/src/locales/nl/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Dutch', code: 'nl', language: 'nl', diff --git a/src/locales/nl_BE/metadata.ts b/src/locales/nl_BE/metadata.ts index 7147811e1f4..f92500c61f5 100644 --- a/src/locales/nl_BE/metadata.ts +++ b/src/locales/nl_BE/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Dutch (Belgium)', code: 'nl_BE', country: 'BE', diff --git a/src/locales/pl/metadata.ts b/src/locales/pl/metadata.ts index 5ab6c1ff640..0031703d2fe 100644 --- a/src/locales/pl/metadata.ts +++ b/src/locales/pl/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Polish', code: 'pl', language: 'pl', diff --git a/src/locales/pt_BR/metadata.ts b/src/locales/pt_BR/metadata.ts index 84e15d34dc8..11bc000872f 100644 --- a/src/locales/pt_BR/metadata.ts +++ b/src/locales/pt_BR/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Portuguese (Brazil)', code: 'pt_BR', country: 'BR', diff --git a/src/locales/pt_PT/metadata.ts b/src/locales/pt_PT/metadata.ts index ef76ba5c6f9..d83a577165f 100644 --- a/src/locales/pt_PT/metadata.ts +++ b/src/locales/pt_PT/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Portuguese (Portugal)', code: 'pt_PT', country: 'PT', diff --git a/src/locales/ro/metadata.ts b/src/locales/ro/metadata.ts index 436abe10263..8f1b6f7ecac 100644 --- a/src/locales/ro/metadata.ts +++ b/src/locales/ro/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Romanian', code: 'ro', language: 'ro', diff --git a/src/locales/ru/metadata.ts b/src/locales/ru/metadata.ts index 80fdfe618b5..bb5d4430f38 100644 --- a/src/locales/ru/metadata.ts +++ b/src/locales/ru/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Russian', code: 'ru', language: 'ru', diff --git a/src/locales/sk/metadata.ts b/src/locales/sk/metadata.ts index 7ca5003e1aa..ff9ed23eb8b 100644 --- a/src/locales/sk/metadata.ts +++ b/src/locales/sk/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Slovak', code: 'sk', language: 'sk', diff --git a/src/locales/sr_RS_latin/metadata.ts b/src/locales/sr_RS_latin/metadata.ts index e2a809a1757..18923eb059a 100644 --- a/src/locales/sr_RS_latin/metadata.ts +++ b/src/locales/sr_RS_latin/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Serbian (Serbia, Latin)', code: 'sr_RS_latin', country: 'RS', diff --git a/src/locales/sv/metadata.ts b/src/locales/sv/metadata.ts index 07a8e5ce30e..13772b45ca5 100644 --- a/src/locales/sv/metadata.ts +++ b/src/locales/sv/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Swedish', code: 'sv', language: 'sv', diff --git a/src/locales/th/metadata.ts b/src/locales/th/metadata.ts index 82ebd1cb4c7..a969875b68c 100644 --- a/src/locales/th/metadata.ts +++ b/src/locales/th/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Thai', code: 'th', language: 'th', diff --git a/src/locales/tr/metadata.ts b/src/locales/tr/metadata.ts index 0eb86f13876..d967e530d36 100644 --- a/src/locales/tr/metadata.ts +++ b/src/locales/tr/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Turkish', code: 'tr', language: 'tr', diff --git a/src/locales/uk/metadata.ts b/src/locales/uk/metadata.ts index c68fe383616..ef1f6c66d17 100644 --- a/src/locales/uk/metadata.ts +++ b/src/locales/uk/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Ukrainian', code: 'uk', language: 'uk', diff --git a/src/locales/ur/metadata.ts b/src/locales/ur/metadata.ts index 09d4e0f0247..787f506172c 100644 --- a/src/locales/ur/metadata.ts +++ b/src/locales/ur/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Urdu', code: 'ur', language: 'ur', diff --git a/src/locales/vi/metadata.ts b/src/locales/vi/metadata.ts index b78eb4eea8d..782e997ffef 100644 --- a/src/locales/vi/metadata.ts +++ b/src/locales/vi/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Vietnamese', code: 'vi', language: 'vi', diff --git a/src/locales/zh_CN/metadata.ts b/src/locales/zh_CN/metadata.ts index 4dc42310e2a..0f8984099c8 100644 --- a/src/locales/zh_CN/metadata.ts +++ b/src/locales/zh_CN/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Chinese (China)', code: 'zh_CN', country: 'CN', diff --git a/src/locales/zh_TW/metadata.ts b/src/locales/zh_TW/metadata.ts index 1d78cf2e570..64043474f72 100644 --- a/src/locales/zh_TW/metadata.ts +++ b/src/locales/zh_TW/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Chinese (Taiwan)', code: 'zh_TW', country: 'TW', diff --git a/src/locales/zu_ZA/metadata.ts b/src/locales/zu_ZA/metadata.ts index 76f9d163a75..57f519bd332 100644 --- a/src/locales/zu_ZA/metadata.ts +++ b/src/locales/zu_ZA/metadata.ts @@ -1,6 +1,6 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Zulu (South Africa)', code: 'zu_ZA', country: 'ZA', diff --git a/src/utils/merge-locales.ts b/src/utils/merge-locales.ts index 1a69f541210..f8233d48b59 100644 --- a/src/utils/merge-locales.ts +++ b/src/utils/merge-locales.ts @@ -13,7 +13,7 @@ import type { LocaleDefinition } from '..'; * const de_CH_with_fallbacks = mergeLocales([ de_CH, de, en ]); */ export function mergeLocales(locales: LocaleDefinition[]): LocaleDefinition { - const merged: LocaleDefinition = {} as LocaleDefinition; + const merged: LocaleDefinition = {}; for (const locale of locales) { for (const key in locale) { From 0fecc4f8f30fb9b7c049e76ae4b6eb3af4c2e347 Mon Sep 17 00:00:00 2001 From: "Mona,Lisa" Date: Sat, 8 Apr 2023 11:16:18 +0700 Subject: [PATCH 4/7] add latin variant --- src/locales/sr_RS_latin/metadata.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/locales/sr_RS_latin/metadata.ts b/src/locales/sr_RS_latin/metadata.ts index 18923eb059a..8c5abf16cff 100644 --- a/src/locales/sr_RS_latin/metadata.ts +++ b/src/locales/sr_RS_latin/metadata.ts @@ -5,6 +5,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { code: 'sr_RS_latin', country: 'RS', language: 'sr', + variant: 'latin', endonym: 'srpski (Srbija, latinica)', rtl: false, script: 'Latn', From 22b673cf8b7d0d75e9e825f803d2eda6caa24657 Mon Sep 17 00:00:00 2001 From: "Mona,Lisa" Date: Sat, 8 Apr 2023 14:19:03 +0700 Subject: [PATCH 5/7] replace rtl boolean with dir string --- src/definitions/metadata.ts | 4 ++-- src/locales/af_ZA/metadata.ts | 2 +- src/locales/ar/metadata.ts | 2 +- src/locales/az/metadata.ts | 2 +- src/locales/cs_CZ/metadata.ts | 2 +- src/locales/de/metadata.ts | 2 +- src/locales/de_AT/metadata.ts | 2 +- src/locales/de_CH/metadata.ts | 2 +- src/locales/dv/metadata.ts | 2 +- src/locales/el/metadata.ts | 2 +- src/locales/en/metadata.ts | 2 +- src/locales/en_AU/metadata.ts | 2 +- src/locales/en_AU_ocker/metadata.ts | 2 +- src/locales/en_BORK/metadata.ts | 2 +- src/locales/en_CA/metadata.ts | 2 +- src/locales/en_GB/metadata.ts | 2 +- src/locales/en_GH/metadata.ts | 2 +- src/locales/en_IE/metadata.ts | 2 +- src/locales/en_IN/metadata.ts | 2 +- src/locales/en_NG/metadata.ts | 2 +- src/locales/en_US/metadata.ts | 2 +- src/locales/en_ZA/metadata.ts | 2 +- src/locales/es/metadata.ts | 2 +- src/locales/es_MX/metadata.ts | 2 +- src/locales/fa/metadata.ts | 2 +- src/locales/fi/metadata.ts | 2 +- src/locales/fr/metadata.ts | 2 +- src/locales/fr_BE/metadata.ts | 2 +- src/locales/fr_CA/metadata.ts | 2 +- src/locales/fr_CH/metadata.ts | 2 +- src/locales/fr_LU/metadata.ts | 2 +- src/locales/he/metadata.ts | 2 +- src/locales/hr/metadata.ts | 2 +- src/locales/hu/metadata.ts | 2 +- src/locales/hy/metadata.ts | 2 +- src/locales/id_ID/metadata.ts | 2 +- src/locales/it/metadata.ts | 2 +- src/locales/ja/metadata.ts | 2 +- src/locales/ka_GE/metadata.ts | 2 +- src/locales/ko/metadata.ts | 2 +- src/locales/lv/metadata.ts | 2 +- src/locales/mk/metadata.ts | 2 +- src/locales/nb_NO/metadata.ts | 2 +- src/locales/ne/metadata.ts | 2 +- src/locales/nl/metadata.ts | 2 +- src/locales/nl_BE/metadata.ts | 2 +- src/locales/pl/metadata.ts | 2 +- src/locales/pt_BR/metadata.ts | 2 +- src/locales/pt_PT/metadata.ts | 2 +- src/locales/ro/metadata.ts | 2 +- src/locales/ru/metadata.ts | 2 +- src/locales/sk/metadata.ts | 2 +- src/locales/sr_RS_latin/metadata.ts | 2 +- src/locales/sv/metadata.ts | 2 +- src/locales/th/metadata.ts | 2 +- src/locales/tr/metadata.ts | 2 +- src/locales/uk/metadata.ts | 2 +- src/locales/ur/metadata.ts | 2 +- src/locales/vi/metadata.ts | 2 +- src/locales/zh_CN/metadata.ts | 2 +- src/locales/zh_TW/metadata.ts | 2 +- src/locales/zu_ZA/metadata.ts | 2 +- test/locale-imports.spec.ts | 3 ++- 63 files changed, 65 insertions(+), 64 deletions(-) diff --git a/src/definitions/metadata.ts b/src/definitions/metadata.ts index f70427201de..9a30c727d67 100644 --- a/src/definitions/metadata.ts +++ b/src/definitions/metadata.ts @@ -29,9 +29,9 @@ export type PreBuiltMetadataDefinitions = { */ variant?: string; /** - * Whether the language is written right-to-left. + * The direction of the language, either 'ltr' (left to right) or 'rtl' (right to left). */ - rtl: boolean; + dir: string; /** * The ISO 15924 code of the script. * diff --git a/src/locales/af_ZA/metadata.ts b/src/locales/af_ZA/metadata.ts index 892570cf8a2..f4787014d74 100644 --- a/src/locales/af_ZA/metadata.ts +++ b/src/locales/af_ZA/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'ZA', language: 'af', endonym: 'Afrikaans (Suid-Afrika)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/ar/metadata.ts b/src/locales/ar/metadata.ts index 3623b1e4b2e..8199b51a272 100644 --- a/src/locales/ar/metadata.ts +++ b/src/locales/ar/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'ar', language: 'ar', endonym: 'اَلْعَرَبِيَّةُ', - rtl: true, + dir: 'rtl', script: 'Arab', }; diff --git a/src/locales/az/metadata.ts b/src/locales/az/metadata.ts index 62851968a7f..1ca746736c5 100644 --- a/src/locales/az/metadata.ts +++ b/src/locales/az/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'az', language: 'az', endonym: 'azərbaycan dili', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/cs_CZ/metadata.ts b/src/locales/cs_CZ/metadata.ts index 77b30a4d67f..2ccd3520a12 100644 --- a/src/locales/cs_CZ/metadata.ts +++ b/src/locales/cs_CZ/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'CZ', language: 'cs', endonym: 'čeština (Česká republika)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/de/metadata.ts b/src/locales/de/metadata.ts index ac914dd0313..f38350f9e1a 100644 --- a/src/locales/de/metadata.ts +++ b/src/locales/de/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'de', language: 'de', endonym: 'Deutsch', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/de_AT/metadata.ts b/src/locales/de_AT/metadata.ts index aefdf311480..2604409bd7a 100644 --- a/src/locales/de_AT/metadata.ts +++ b/src/locales/de_AT/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'AT', language: 'de', endonym: 'Deutsch (Österreich)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/de_CH/metadata.ts b/src/locales/de_CH/metadata.ts index 5d5f5f950d3..75bbb76b636 100644 --- a/src/locales/de_CH/metadata.ts +++ b/src/locales/de_CH/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'CH', language: 'de', endonym: 'Deutsch (Schweiz)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/dv/metadata.ts b/src/locales/dv/metadata.ts index 981955246ac..5329afced82 100644 --- a/src/locales/dv/metadata.ts +++ b/src/locales/dv/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'dv', language: 'dv', endonym: 'ދިވެހި', - rtl: true, + dir: 'rtl', script: 'Thaa', }; diff --git a/src/locales/el/metadata.ts b/src/locales/el/metadata.ts index d015ddbf0f9..76197ab3542 100644 --- a/src/locales/el/metadata.ts +++ b/src/locales/el/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'el', language: 'el', endonym: 'Ελληνικά', - rtl: false, + dir: 'ltr', script: 'Grek', }; diff --git a/src/locales/en/metadata.ts b/src/locales/en/metadata.ts index cb9844bc44b..f31fcffcb14 100644 --- a/src/locales/en/metadata.ts +++ b/src/locales/en/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'en', language: 'en', endonym: 'English', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_AU/metadata.ts b/src/locales/en_AU/metadata.ts index d8912059221..b50713a914a 100644 --- a/src/locales/en_AU/metadata.ts +++ b/src/locales/en_AU/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'AU', language: 'en', endonym: 'English (Australia)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_AU_ocker/metadata.ts b/src/locales/en_AU_ocker/metadata.ts index c6133bd6e42..3159e688c5a 100644 --- a/src/locales/en_AU_ocker/metadata.ts +++ b/src/locales/en_AU_ocker/metadata.ts @@ -7,7 +7,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { language: 'en', variant: 'ocker', endonym: 'English (Australia)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_BORK/metadata.ts b/src/locales/en_BORK/metadata.ts index 61e08a90b8e..d250e9ceb40 100644 --- a/src/locales/en_BORK/metadata.ts +++ b/src/locales/en_BORK/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitions = { variant: 'BORK', language: 'en', endonym: 'English (Bork)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_CA/metadata.ts b/src/locales/en_CA/metadata.ts index d528514b8c7..31777930bbf 100644 --- a/src/locales/en_CA/metadata.ts +++ b/src/locales/en_CA/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'CA', language: 'en', endonym: 'English (Canada)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_GB/metadata.ts b/src/locales/en_GB/metadata.ts index 5b37fb6bdf8..bd33818d93b 100644 --- a/src/locales/en_GB/metadata.ts +++ b/src/locales/en_GB/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'GB', language: 'en', endonym: 'English (Great Britain)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_GH/metadata.ts b/src/locales/en_GH/metadata.ts index 7a79a96fd9d..46171582792 100644 --- a/src/locales/en_GH/metadata.ts +++ b/src/locales/en_GH/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'GH', language: 'en', endonym: 'English (Ghana)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_IE/metadata.ts b/src/locales/en_IE/metadata.ts index 582986ba848..a853c874004 100644 --- a/src/locales/en_IE/metadata.ts +++ b/src/locales/en_IE/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'IE', language: 'en', endonym: 'English (Ireland)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_IN/metadata.ts b/src/locales/en_IN/metadata.ts index a274fdcd911..9eafd9f555e 100644 --- a/src/locales/en_IN/metadata.ts +++ b/src/locales/en_IN/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'IN', language: 'en', endonym: 'English (India)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_NG/metadata.ts b/src/locales/en_NG/metadata.ts index 6cd220b2d39..98833de343e 100644 --- a/src/locales/en_NG/metadata.ts +++ b/src/locales/en_NG/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'NG', language: 'en', endonym: 'English (Nigeria)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_US/metadata.ts b/src/locales/en_US/metadata.ts index 9932bac29e3..a0bbdd39a12 100644 --- a/src/locales/en_US/metadata.ts +++ b/src/locales/en_US/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'US', language: 'en', endonym: 'English (United States)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/en_ZA/metadata.ts b/src/locales/en_ZA/metadata.ts index 303b181922b..6047da0a378 100644 --- a/src/locales/en_ZA/metadata.ts +++ b/src/locales/en_ZA/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'ZA', language: 'en', endonym: 'English (South Africa)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/es/metadata.ts b/src/locales/es/metadata.ts index b2b99581989..c1cc17a5313 100644 --- a/src/locales/es/metadata.ts +++ b/src/locales/es/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'es', language: 'es', endonym: 'Español', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/es_MX/metadata.ts b/src/locales/es_MX/metadata.ts index 90cb1d2b348..a9cacd663fa 100644 --- a/src/locales/es_MX/metadata.ts +++ b/src/locales/es_MX/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'MX', language: 'es', endonym: 'Español (México)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/fa/metadata.ts b/src/locales/fa/metadata.ts index 5488397edec..88503c546d3 100644 --- a/src/locales/fa/metadata.ts +++ b/src/locales/fa/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'fa', language: 'fa', endonym: 'فارسی', - rtl: true, + dir: 'rtl', script: 'Arab', }; diff --git a/src/locales/fi/metadata.ts b/src/locales/fi/metadata.ts index 9b20a3b1c82..43d45fcbde4 100644 --- a/src/locales/fi/metadata.ts +++ b/src/locales/fi/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'fi', language: 'fi', endonym: 'suomi', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/fr/metadata.ts b/src/locales/fr/metadata.ts index 6afeb2dc209..eb49f56f70c 100644 --- a/src/locales/fr/metadata.ts +++ b/src/locales/fr/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'fr', language: 'fr', endonym: 'Français', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/fr_BE/metadata.ts b/src/locales/fr_BE/metadata.ts index 6302b0f492c..d98eb72be7e 100644 --- a/src/locales/fr_BE/metadata.ts +++ b/src/locales/fr_BE/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'BE', language: 'fr', endonym: 'Français (Belgique)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/fr_CA/metadata.ts b/src/locales/fr_CA/metadata.ts index 9d8b185303f..62e5406221d 100644 --- a/src/locales/fr_CA/metadata.ts +++ b/src/locales/fr_CA/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'CA', language: 'fr', endonym: 'Français (Canada)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/fr_CH/metadata.ts b/src/locales/fr_CH/metadata.ts index b51ab74b835..86b69f348e0 100644 --- a/src/locales/fr_CH/metadata.ts +++ b/src/locales/fr_CH/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'CH', language: 'fr', endonym: 'Français (Suisse)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/fr_LU/metadata.ts b/src/locales/fr_LU/metadata.ts index 3ddfcde770c..b8656a675be 100644 --- a/src/locales/fr_LU/metadata.ts +++ b/src/locales/fr_LU/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'LU', language: 'fr', endonym: 'Français (Luxembourg)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/he/metadata.ts b/src/locales/he/metadata.ts index 6ed4091b387..a3c41bac261 100644 --- a/src/locales/he/metadata.ts +++ b/src/locales/he/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'he', language: 'he', endonym: 'עברית', - rtl: true, + dir: 'rtl', script: 'Hebr', }; diff --git a/src/locales/hr/metadata.ts b/src/locales/hr/metadata.ts index b0477ebc86f..e4014aaf623 100644 --- a/src/locales/hr/metadata.ts +++ b/src/locales/hr/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'hr', language: 'hr', endonym: 'Hrvatski', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/hu/metadata.ts b/src/locales/hu/metadata.ts index 2db99443514..48da69ad9b6 100644 --- a/src/locales/hu/metadata.ts +++ b/src/locales/hu/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'hu', language: 'hu', endonym: 'magyar', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/hy/metadata.ts b/src/locales/hy/metadata.ts index 666bee3d8bd..835636e1728 100644 --- a/src/locales/hy/metadata.ts +++ b/src/locales/hy/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'hy', language: 'hy', endonym: 'Հայերեն', - rtl: false, + dir: 'ltr', script: 'Armn', }; diff --git a/src/locales/id_ID/metadata.ts b/src/locales/id_ID/metadata.ts index 114a1db4f23..795e1585bb4 100644 --- a/src/locales/id_ID/metadata.ts +++ b/src/locales/id_ID/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'ID', language: 'id', endonym: 'Bahasa Indonesia (Indonesia)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/it/metadata.ts b/src/locales/it/metadata.ts index a23ea0bfb67..b53e40577e0 100644 --- a/src/locales/it/metadata.ts +++ b/src/locales/it/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'it', language: 'it', endonym: 'Italiano', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/ja/metadata.ts b/src/locales/ja/metadata.ts index 386c9c7b800..3e61ca9643d 100644 --- a/src/locales/ja/metadata.ts +++ b/src/locales/ja/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'ja', language: 'ja', endonym: '日本語', - rtl: false, + dir: 'ltr', script: 'Jpan', }; diff --git a/src/locales/ka_GE/metadata.ts b/src/locales/ka_GE/metadata.ts index 1df7aa76d0d..bef4d2b1f45 100644 --- a/src/locales/ka_GE/metadata.ts +++ b/src/locales/ka_GE/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'GE', language: 'ka', endonym: 'ქართული (საქართველო)', - rtl: false, + dir: 'ltr', script: 'Geor', }; diff --git a/src/locales/ko/metadata.ts b/src/locales/ko/metadata.ts index 16413342172..4fa91e58354 100644 --- a/src/locales/ko/metadata.ts +++ b/src/locales/ko/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'ko', language: 'ko', endonym: '한국어', - rtl: false, + dir: 'ltr', script: 'Kore', }; diff --git a/src/locales/lv/metadata.ts b/src/locales/lv/metadata.ts index 3e875fda5ce..6685a322f01 100644 --- a/src/locales/lv/metadata.ts +++ b/src/locales/lv/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'lv', language: 'lv', endonym: 'latviešu valoda', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/mk/metadata.ts b/src/locales/mk/metadata.ts index 4d1cc7493f9..1ce27a683c6 100644 --- a/src/locales/mk/metadata.ts +++ b/src/locales/mk/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'mk', language: 'mk', endonym: 'македонски јазик', - rtl: false, + dir: 'ltr', script: 'Cyrl', }; diff --git a/src/locales/nb_NO/metadata.ts b/src/locales/nb_NO/metadata.ts index 3848d5d369a..5eb03faf8e9 100644 --- a/src/locales/nb_NO/metadata.ts +++ b/src/locales/nb_NO/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'NO', language: 'nb', endonym: 'Norsk bokmål (Norge)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/ne/metadata.ts b/src/locales/ne/metadata.ts index 57d978dc14c..c84292888e2 100644 --- a/src/locales/ne/metadata.ts +++ b/src/locales/ne/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'ne', language: 'ne', endonym: 'नेपाली', - rtl: false, + dir: 'ltr', script: 'Deva', }; diff --git a/src/locales/nl/metadata.ts b/src/locales/nl/metadata.ts index 7a3a178149f..a72d9790760 100644 --- a/src/locales/nl/metadata.ts +++ b/src/locales/nl/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'nl', language: 'nl', endonym: 'Nederlands', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/nl_BE/metadata.ts b/src/locales/nl_BE/metadata.ts index f92500c61f5..73b0f1dccd0 100644 --- a/src/locales/nl_BE/metadata.ts +++ b/src/locales/nl_BE/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'BE', language: 'nl', endonym: 'Nederlands (België)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/pl/metadata.ts b/src/locales/pl/metadata.ts index 0031703d2fe..c9e95c34a68 100644 --- a/src/locales/pl/metadata.ts +++ b/src/locales/pl/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'pl', language: 'pl', endonym: 'Polski', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/pt_BR/metadata.ts b/src/locales/pt_BR/metadata.ts index 11bc000872f..7feb002f955 100644 --- a/src/locales/pt_BR/metadata.ts +++ b/src/locales/pt_BR/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'BR', language: 'pt', endonym: 'Português (Brasil)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/pt_PT/metadata.ts b/src/locales/pt_PT/metadata.ts index d83a577165f..650782074bd 100644 --- a/src/locales/pt_PT/metadata.ts +++ b/src/locales/pt_PT/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'PT', language: 'pt', endonym: 'Português (Portugal)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/ro/metadata.ts b/src/locales/ro/metadata.ts index 8f1b6f7ecac..e10c0d355be 100644 --- a/src/locales/ro/metadata.ts +++ b/src/locales/ro/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'ro', language: 'ro', endonym: 'Română', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/ru/metadata.ts b/src/locales/ru/metadata.ts index bb5d4430f38..8e6db955bac 100644 --- a/src/locales/ru/metadata.ts +++ b/src/locales/ru/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'ru', language: 'ru', endonym: 'Русский', - rtl: false, + dir: 'ltr', script: 'Cyrl', }; diff --git a/src/locales/sk/metadata.ts b/src/locales/sk/metadata.ts index ff9ed23eb8b..0bc938d168f 100644 --- a/src/locales/sk/metadata.ts +++ b/src/locales/sk/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'sk', language: 'sk', endonym: 'slovenčina', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/sr_RS_latin/metadata.ts b/src/locales/sr_RS_latin/metadata.ts index 8c5abf16cff..b94b341054a 100644 --- a/src/locales/sr_RS_latin/metadata.ts +++ b/src/locales/sr_RS_latin/metadata.ts @@ -7,7 +7,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { language: 'sr', variant: 'latin', endonym: 'srpski (Srbija, latinica)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/sv/metadata.ts b/src/locales/sv/metadata.ts index 13772b45ca5..e206b2d6a09 100644 --- a/src/locales/sv/metadata.ts +++ b/src/locales/sv/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'sv', language: 'sv', endonym: 'Svenska', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/th/metadata.ts b/src/locales/th/metadata.ts index a969875b68c..ae53d4ace60 100644 --- a/src/locales/th/metadata.ts +++ b/src/locales/th/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'th', language: 'th', endonym: 'ไทย', - rtl: false, + dir: 'ltr', script: 'Thai', }; diff --git a/src/locales/tr/metadata.ts b/src/locales/tr/metadata.ts index d967e530d36..9315cae1827 100644 --- a/src/locales/tr/metadata.ts +++ b/src/locales/tr/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'tr', language: 'tr', endonym: 'Türkçe', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/uk/metadata.ts b/src/locales/uk/metadata.ts index ef1f6c66d17..6f305d8920f 100644 --- a/src/locales/uk/metadata.ts +++ b/src/locales/uk/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'uk', language: 'uk', endonym: 'Українська', - rtl: false, + dir: 'ltr', script: 'Cyrl', }; diff --git a/src/locales/ur/metadata.ts b/src/locales/ur/metadata.ts index 787f506172c..6977c4ae110 100644 --- a/src/locales/ur/metadata.ts +++ b/src/locales/ur/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'ur', language: 'ur', endonym: 'اردو', - rtl: true, + dir: 'rtl', script: 'Arab', }; diff --git a/src/locales/vi/metadata.ts b/src/locales/vi/metadata.ts index 782e997ffef..abf574f3953 100644 --- a/src/locales/vi/metadata.ts +++ b/src/locales/vi/metadata.ts @@ -5,7 +5,7 @@ const metadata: PreBuiltMetadataDefinitions = { code: 'vi', language: 'vi', endonym: 'Tiếng Việt', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/src/locales/zh_CN/metadata.ts b/src/locales/zh_CN/metadata.ts index 0f8984099c8..44f79bbee6a 100644 --- a/src/locales/zh_CN/metadata.ts +++ b/src/locales/zh_CN/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'CN', language: 'zh', endonym: '中文 (中国)', - rtl: false, + dir: 'ltr', script: 'Hans', }; diff --git a/src/locales/zh_TW/metadata.ts b/src/locales/zh_TW/metadata.ts index 64043474f72..269c4e0cb81 100644 --- a/src/locales/zh_TW/metadata.ts +++ b/src/locales/zh_TW/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'TW', language: 'zh', endonym: '中文 (臺灣)', - rtl: false, + dir: 'ltr', script: 'Hant', }; diff --git a/src/locales/zu_ZA/metadata.ts b/src/locales/zu_ZA/metadata.ts index 57f519bd332..c6553acdeef 100644 --- a/src/locales/zu_ZA/metadata.ts +++ b/src/locales/zu_ZA/metadata.ts @@ -6,7 +6,7 @@ const metadata: PreBuiltMetadataDefinitionsForCountry = { country: 'ZA', language: 'zu', endonym: 'isiZulu (Iningizimu Afrika)', - rtl: false, + dir: 'ltr', script: 'Latn', }; diff --git a/test/locale-imports.spec.ts b/test/locale-imports.spec.ts index 6662e035b53..81f40e7a7b3 100644 --- a/test/locale-imports.spec.ts +++ b/test/locale-imports.spec.ts @@ -55,7 +55,8 @@ describe('locale imports', () => { 'Thai', ]).toContain(metadata.script); expect(metadata.endonym).toBeTypeOf('string'); - expect(metadata.rtl).toBeTypeOf('boolean'); + expect(metadata.dir).toBeTypeOf('string'); + expect(['ltr', 'rtl']).toContain(metadata.dir); if (metadata.country) { expect(metadata.country).toBeTypeOf('string'); expect(metadata.country).toMatch(/^[A-Z]{2}$/); From 9894480dc586b76fba6da51e6cfaac167a3a816f Mon Sep 17 00:00:00 2001 From: Matt Mayer <152770+matthewmayer@users.noreply.github.com> Date: Sun, 9 Apr 2023 15:39:25 +0700 Subject: [PATCH 6/7] Update src/definitions/metadata.ts Co-authored-by: Shinigami --- src/definitions/metadata.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/definitions/metadata.ts b/src/definitions/metadata.ts index 9a30c727d67..c5ee074b8e7 100644 --- a/src/definitions/metadata.ts +++ b/src/definitions/metadata.ts @@ -31,7 +31,7 @@ export type PreBuiltMetadataDefinitions = { /** * The direction of the language, either 'ltr' (left to right) or 'rtl' (right to left). */ - dir: string; + dir: 'ltr' | 'rtl'; /** * The ISO 15924 code of the script. * From d4123b03887b76f642d4bcef5d7c9248ec0db4fc Mon Sep 17 00:00:00 2001 From: Matt Mayer <152770+matthewmayer@users.noreply.github.com> Date: Sun, 9 Apr 2023 15:39:35 +0700 Subject: [PATCH 7/7] Update test/locale-imports.spec.ts Co-authored-by: Shinigami --- test/locale-imports.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/locale-imports.spec.ts b/test/locale-imports.spec.ts index 81f40e7a7b3..2a691b269d4 100644 --- a/test/locale-imports.spec.ts +++ b/test/locale-imports.spec.ts @@ -29,7 +29,7 @@ describe('locale imports', () => { ); }); - it(`should have complete metadata values`, () => { + it('should have complete metadata values', () => { const metadata = allLocales[locale].metadata; expect(metadata.title).toBeTypeOf('string'); expect(metadata.code).toBeTypeOf('string');