From a49aa0d7831a949728b6831b96f15c4971f1e1d9 Mon Sep 17 00:00:00 2001 From: Matt Mayer <152770+matthewmayer@users.noreply.github.com> Date: Sat, 22 Apr 2023 23:26:46 +0700 Subject: [PATCH] feat(locale): add additional metadata properties (#2025) --- docs/guide/localization.md | 16 ++++---- src/definitions/definitions.ts | 2 +- src/definitions/metadata.ts | 58 ++++++++++++++++++++++++++++- src/locales/af_ZA/metadata.ts | 12 ++++-- src/locales/ar/metadata.ts | 9 ++++- src/locales/az/metadata.ts | 9 ++++- src/locales/base/metadata.ts | 1 + src/locales/cs_CZ/metadata.ts | 10 ++++- src/locales/de/metadata.ts | 9 ++++- src/locales/de_AT/metadata.ts | 10 ++++- src/locales/de_CH/metadata.ts | 10 ++++- src/locales/dv/metadata.ts | 9 ++++- src/locales/el/metadata.ts | 9 ++++- src/locales/en/metadata.ts | 9 ++++- src/locales/en_AU/metadata.ts | 10 ++++- src/locales/en_AU_ocker/metadata.ts | 11 +++++- src/locales/en_BORK/metadata.ts | 10 ++++- src/locales/en_CA/metadata.ts | 10 ++++- src/locales/en_GB/metadata.ts | 10 ++++- src/locales/en_GH/metadata.ts | 10 ++++- src/locales/en_IE/metadata.ts | 10 ++++- src/locales/en_IN/metadata.ts | 10 ++++- src/locales/en_NG/metadata.ts | 10 ++++- src/locales/en_US/metadata.ts | 10 ++++- src/locales/en_ZA/metadata.ts | 10 ++++- src/locales/es/metadata.ts | 9 ++++- src/locales/es_MX/metadata.ts | 10 ++++- src/locales/fa/metadata.ts | 11 ++++-- src/locales/fi/metadata.ts | 9 ++++- src/locales/fr/metadata.ts | 9 ++++- src/locales/fr_BE/metadata.ts | 10 ++++- src/locales/fr_CA/metadata.ts | 10 ++++- src/locales/fr_CH/metadata.ts | 10 ++++- src/locales/fr_LU/metadata.ts | 10 ++++- src/locales/he/metadata.ts | 9 ++++- src/locales/hr/metadata.ts | 9 ++++- src/locales/hu/metadata.ts | 9 ++++- src/locales/hy/metadata.ts | 9 ++++- src/locales/id_ID/metadata.ts | 12 ++++-- src/locales/it/metadata.ts | 9 ++++- src/locales/ja/metadata.ts | 9 ++++- src/locales/ka_GE/metadata.ts | 10 ++++- src/locales/ko/metadata.ts | 9 ++++- src/locales/lv/metadata.ts | 9 ++++- src/locales/mk/metadata.ts | 9 ++++- src/locales/nb_NO/metadata.ts | 12 ++++-- src/locales/ne/metadata.ts | 11 ++++-- src/locales/nl/metadata.ts | 9 ++++- src/locales/nl_BE/metadata.ts | 10 ++++- src/locales/pl/metadata.ts | 9 ++++- src/locales/pt_BR/metadata.ts | 10 ++++- src/locales/pt_PT/metadata.ts | 10 ++++- src/locales/ro/metadata.ts | 9 ++++- src/locales/ru/metadata.ts | 9 ++++- src/locales/sk/metadata.ts | 11 ++++-- src/locales/sr_RS_latin/metadata.ts | 13 +++++-- src/locales/sv/metadata.ts | 9 ++++- src/locales/th/metadata.ts | 9 ++++- src/locales/tr/metadata.ts | 9 ++++- src/locales/uk/metadata.ts | 9 ++++- src/locales/ur/metadata.ts | 9 ++++- src/locales/vi/metadata.ts | 9 ++++- src/locales/zh_CN/metadata.ts | 12 ++++-- src/locales/zh_TW/metadata.ts | 10 ++++- src/locales/zu_ZA/metadata.ts | 10 ++++- src/utils/merge-locales.ts | 2 +- test/locale-imports.spec.ts | 35 +++++++++++++++++ 67 files changed, 569 insertions(+), 142 deletions(-) diff --git a/docs/guide/localization.md b/docs/guide/localization.md index e6e16c4241e..407d411fe27 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/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 398c2c2abb9..c5ee074b8e7 100644 --- a/src/definitions/metadata.ts +++ b/src/definitions/metadata.ts @@ -1,6 +1,60 @@ -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). */ title: string; -} & Record; + /** + * 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 specific variant of the language. This usually refers to a dialect or slang. + */ + variant?: string; + /** + * The direction of the language, either 'ltr' (left to right) or 'rtl' (right to left). + */ + dir: 'ltr' | 'rtl'; + /** + * The ISO 15924 code of the script. + * + * @see https://en.wikipedia.org/wiki/ISO_15924 + */ + 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 32120b0054d..f4787014d74 100644 --- a/src/locales/af_ZA/metadata.ts +++ b/src/locales/af_ZA/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { - title: 'Afrikaans', +const metadata: PreBuiltMetadataDefinitionsForCountry = { + title: 'Afrikaans (South Africa)', + code: 'af_ZA', + country: 'ZA', + language: 'af', + endonym: 'Afrikaans (Suid-Afrika)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/ar/metadata.ts b/src/locales/ar/metadata.ts index f94ccd80fd9..8199b51a272 100644 --- a/src/locales/ar/metadata.ts +++ b/src/locales/ar/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Arabic', + code: 'ar', + language: 'ar', + endonym: 'اَلْعَرَبِيَّةُ', + dir: 'rtl', + script: 'Arab', }; export default metadata; diff --git a/src/locales/az/metadata.ts b/src/locales/az/metadata.ts index c1360366da1..1ca746736c5 100644 --- a/src/locales/az/metadata.ts +++ b/src/locales/az/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Azerbaijani', + code: 'az', + language: 'az', + endonym: 'azərbaycan dili', + dir: 'ltr', + 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..2ccd3520a12 100644 --- a/src/locales/cs_CZ/metadata.ts +++ b/src/locales/cs_CZ/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Czech (Czechia)', + code: 'cs_CZ', + country: 'CZ', + language: 'cs', + endonym: 'čeština (Česká republika)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/de/metadata.ts b/src/locales/de/metadata.ts index d66b6de10b0..f38350f9e1a 100644 --- a/src/locales/de/metadata.ts +++ b/src/locales/de/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'German', + code: 'de', + language: 'de', + endonym: 'Deutsch', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/de_AT/metadata.ts b/src/locales/de_AT/metadata.ts index db773f7760c..2604409bd7a 100644 --- a/src/locales/de_AT/metadata.ts +++ b/src/locales/de_AT/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'German (Austria)', + code: 'de_AT', + country: 'AT', + language: 'de', + endonym: 'Deutsch (Österreich)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/de_CH/metadata.ts b/src/locales/de_CH/metadata.ts index 4e462b89bb4..75bbb76b636 100644 --- a/src/locales/de_CH/metadata.ts +++ b/src/locales/de_CH/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'German (Switzerland)', + code: 'de_CH', + country: 'CH', + language: 'de', + endonym: 'Deutsch (Schweiz)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/dv/metadata.ts b/src/locales/dv/metadata.ts index d30d10a259e..5329afced82 100644 --- a/src/locales/dv/metadata.ts +++ b/src/locales/dv/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Maldivian', + code: 'dv', + language: 'dv', + endonym: 'ދިވެހި', + dir: 'rtl', + script: 'Thaa', }; export default metadata; diff --git a/src/locales/el/metadata.ts b/src/locales/el/metadata.ts index 17dd91dc55c..76197ab3542 100644 --- a/src/locales/el/metadata.ts +++ b/src/locales/el/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Greek', + code: 'el', + language: 'el', + endonym: 'Ελληνικά', + dir: 'ltr', + script: 'Grek', }; export default metadata; diff --git a/src/locales/en/metadata.ts b/src/locales/en/metadata.ts index 30a936374ae..f31fcffcb14 100644 --- a/src/locales/en/metadata.ts +++ b/src/locales/en/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'English', + code: 'en', + language: 'en', + endonym: 'English', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_AU/metadata.ts b/src/locales/en_AU/metadata.ts index be925f152af..b50713a914a 100644 --- a/src/locales/en_AU/metadata.ts +++ b/src/locales/en_AU/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Australia)', + code: 'en_AU', + country: 'AU', + language: 'en', + endonym: 'English (Australia)', + dir: 'ltr', + 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..3159e688c5a 100644 --- a/src/locales/en_AU_ocker/metadata.ts +++ b/src/locales/en_AU_ocker/metadata.ts @@ -1,7 +1,14 @@ -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', + language: 'en', + variant: 'ocker', + endonym: 'English (Australia)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_BORK/metadata.ts b/src/locales/en_BORK/metadata.ts index 7349bdca79b..d250e9ceb40 100644 --- a/src/locales/en_BORK/metadata.ts +++ b/src/locales/en_BORK/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'English (Bork)', + code: 'en_BORK', + variant: 'BORK', + language: 'en', + endonym: 'English (Bork)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_CA/metadata.ts b/src/locales/en_CA/metadata.ts index 40ea4ad07fc..31777930bbf 100644 --- a/src/locales/en_CA/metadata.ts +++ b/src/locales/en_CA/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Canada)', + code: 'en_CA', + country: 'CA', + language: 'en', + endonym: 'English (Canada)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_GB/metadata.ts b/src/locales/en_GB/metadata.ts index 4007132ea1f..bd33818d93b 100644 --- a/src/locales/en_GB/metadata.ts +++ b/src/locales/en_GB/metadata.ts @@ -1,7 +1,13 @@ -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', + language: 'en', + endonym: 'English (Great Britain)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_GH/metadata.ts b/src/locales/en_GH/metadata.ts index 9bd30240c2f..46171582792 100644 --- a/src/locales/en_GH/metadata.ts +++ b/src/locales/en_GH/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Ghana)', + code: 'en_GH', + country: 'GH', + language: 'en', + endonym: 'English (Ghana)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_IE/metadata.ts b/src/locales/en_IE/metadata.ts index 765b371c3f8..a853c874004 100644 --- a/src/locales/en_IE/metadata.ts +++ b/src/locales/en_IE/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Ireland)', + code: 'en_IE', + country: 'IE', + language: 'en', + endonym: 'English (Ireland)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_IN/metadata.ts b/src/locales/en_IN/metadata.ts index dd7ce2ca2ed..9eafd9f555e 100644 --- a/src/locales/en_IN/metadata.ts +++ b/src/locales/en_IN/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (India)', + code: 'en_IN', + country: 'IN', + language: 'en', + endonym: 'English (India)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_NG/metadata.ts b/src/locales/en_NG/metadata.ts index fed81e3fd54..98833de343e 100644 --- a/src/locales/en_NG/metadata.ts +++ b/src/locales/en_NG/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'English (Nigeria)', + code: 'en_NG', + country: 'NG', + language: 'en', + endonym: 'English (Nigeria)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_US/metadata.ts b/src/locales/en_US/metadata.ts index c08c0170734..a0bbdd39a12 100644 --- a/src/locales/en_US/metadata.ts +++ b/src/locales/en_US/metadata.ts @@ -1,7 +1,13 @@ -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', + language: 'en', + endonym: 'English (United States)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/en_ZA/metadata.ts b/src/locales/en_ZA/metadata.ts index dbca3b102a1..6047da0a378 100644 --- a/src/locales/en_ZA/metadata.ts +++ b/src/locales/en_ZA/metadata.ts @@ -1,7 +1,13 @@ -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', + language: 'en', + endonym: 'English (South Africa)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/es/metadata.ts b/src/locales/es/metadata.ts index b6c6cf19068..c1cc17a5313 100644 --- a/src/locales/es/metadata.ts +++ b/src/locales/es/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Spanish', + code: 'es', + language: 'es', + endonym: 'Español', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/es_MX/metadata.ts b/src/locales/es_MX/metadata.ts index 540895d68e3..a9cacd663fa 100644 --- a/src/locales/es_MX/metadata.ts +++ b/src/locales/es_MX/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Spanish (Mexico)', + code: 'es_MX', + country: 'MX', + language: 'es', + endonym: 'Español (México)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/fa/metadata.ts b/src/locales/fa/metadata.ts index 0fc4f55cf17..88503c546d3 100644 --- a/src/locales/fa/metadata.ts +++ b/src/locales/fa/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { - title: 'Farsi', +const metadata: PreBuiltMetadataDefinitions = { + title: 'Farsi/Persian', + code: 'fa', + language: 'fa', + endonym: 'فارسی', + dir: 'rtl', + script: 'Arab', }; export default metadata; diff --git a/src/locales/fi/metadata.ts b/src/locales/fi/metadata.ts index 08115a1ace3..43d45fcbde4 100644 --- a/src/locales/fi/metadata.ts +++ b/src/locales/fi/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Finnish', + code: 'fi', + language: 'fi', + endonym: 'suomi', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr/metadata.ts b/src/locales/fr/metadata.ts index 45f83699022..eb49f56f70c 100644 --- a/src/locales/fr/metadata.ts +++ b/src/locales/fr/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'French', + code: 'fr', + language: 'fr', + endonym: 'Français', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr_BE/metadata.ts b/src/locales/fr_BE/metadata.ts index 87a70b2773b..d98eb72be7e 100644 --- a/src/locales/fr_BE/metadata.ts +++ b/src/locales/fr_BE/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'French (Belgium)', + code: 'fr_BE', + country: 'BE', + language: 'fr', + endonym: 'Français (Belgique)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr_CA/metadata.ts b/src/locales/fr_CA/metadata.ts index 306b3296f2f..62e5406221d 100644 --- a/src/locales/fr_CA/metadata.ts +++ b/src/locales/fr_CA/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'French (Canada)', + code: 'fr_CA', + country: 'CA', + language: 'fr', + endonym: 'Français (Canada)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr_CH/metadata.ts b/src/locales/fr_CH/metadata.ts index 5b191b8161b..86b69f348e0 100644 --- a/src/locales/fr_CH/metadata.ts +++ b/src/locales/fr_CH/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'French (Switzerland)', + code: 'fr_CH', + country: 'CH', + language: 'fr', + endonym: 'Français (Suisse)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/fr_LU/metadata.ts b/src/locales/fr_LU/metadata.ts index 79da9cef665..b8656a675be 100644 --- a/src/locales/fr_LU/metadata.ts +++ b/src/locales/fr_LU/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'French (Luxembourg)', + code: 'fr_LU', + country: 'LU', + language: 'fr', + endonym: 'Français (Luxembourg)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/he/metadata.ts b/src/locales/he/metadata.ts index e816e529835..a3c41bac261 100644 --- a/src/locales/he/metadata.ts +++ b/src/locales/he/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Hebrew', + code: 'he', + language: 'he', + endonym: 'עברית', + dir: 'rtl', + script: 'Hebr', }; export default metadata; diff --git a/src/locales/hr/metadata.ts b/src/locales/hr/metadata.ts index bc95cdaadac..e4014aaf623 100644 --- a/src/locales/hr/metadata.ts +++ b/src/locales/hr/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Croatian', + code: 'hr', + language: 'hr', + endonym: 'Hrvatski', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/hu/metadata.ts b/src/locales/hu/metadata.ts index 8602d9a0117..48da69ad9b6 100644 --- a/src/locales/hu/metadata.ts +++ b/src/locales/hu/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Hungarian', + code: 'hu', + language: 'hu', + endonym: 'magyar', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/hy/metadata.ts b/src/locales/hy/metadata.ts index c20110c1501..835636e1728 100644 --- a/src/locales/hy/metadata.ts +++ b/src/locales/hy/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Armenian', + code: 'hy', + language: 'hy', + endonym: 'Հայերեն', + dir: 'ltr', + script: 'Armn', }; export default metadata; diff --git a/src/locales/id_ID/metadata.ts b/src/locales/id_ID/metadata.ts index 73df9ea4eaa..795e1585bb4 100644 --- a/src/locales/id_ID/metadata.ts +++ b/src/locales/id_ID/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { - title: 'Indonesian', +const metadata: PreBuiltMetadataDefinitionsForCountry = { + title: 'Indonesian (Indonesia)', + code: 'id_ID', + country: 'ID', + language: 'id', + endonym: 'Bahasa Indonesia (Indonesia)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/it/metadata.ts b/src/locales/it/metadata.ts index 78e7e2ee2fe..b53e40577e0 100644 --- a/src/locales/it/metadata.ts +++ b/src/locales/it/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Italian', + code: 'it', + language: 'it', + endonym: 'Italiano', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/ja/metadata.ts b/src/locales/ja/metadata.ts index e1f2e3a22f2..3e61ca9643d 100644 --- a/src/locales/ja/metadata.ts +++ b/src/locales/ja/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Japanese', + code: 'ja', + language: 'ja', + endonym: '日本語', + dir: 'ltr', + script: 'Jpan', }; export default metadata; diff --git a/src/locales/ka_GE/metadata.ts b/src/locales/ka_GE/metadata.ts index 5a049913438..bef4d2b1f45 100644 --- a/src/locales/ka_GE/metadata.ts +++ b/src/locales/ka_GE/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Georgian (Georgia)', + code: 'ka_GE', + country: 'GE', + language: 'ka', + endonym: 'ქართული (საქართველო)', + dir: 'ltr', + script: 'Geor', }; export default metadata; diff --git a/src/locales/ko/metadata.ts b/src/locales/ko/metadata.ts index f5343b2fd45..4fa91e58354 100644 --- a/src/locales/ko/metadata.ts +++ b/src/locales/ko/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Korean', + code: 'ko', + language: 'ko', + endonym: '한국어', + dir: 'ltr', + script: 'Kore', }; export default metadata; diff --git a/src/locales/lv/metadata.ts b/src/locales/lv/metadata.ts index 60b0cf2f012..6685a322f01 100644 --- a/src/locales/lv/metadata.ts +++ b/src/locales/lv/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Latvian', + code: 'lv', + language: 'lv', + endonym: 'latviešu valoda', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/mk/metadata.ts b/src/locales/mk/metadata.ts index 6c564a10f8f..1ce27a683c6 100644 --- a/src/locales/mk/metadata.ts +++ b/src/locales/mk/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Macedonian', + code: 'mk', + language: 'mk', + endonym: 'македонски јазик', + dir: 'ltr', + script: 'Cyrl', }; export default metadata; diff --git a/src/locales/nb_NO/metadata.ts b/src/locales/nb_NO/metadata.ts index 5037872f442..5eb03faf8e9 100644 --- a/src/locales/nb_NO/metadata.ts +++ b/src/locales/nb_NO/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { - title: 'Norwegian', +const metadata: PreBuiltMetadataDefinitionsForCountry = { + title: 'Norwegian (Norway)', + code: 'nb_NO', + country: 'NO', + language: 'nb', + endonym: 'Norsk bokmål (Norge)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/ne/metadata.ts b/src/locales/ne/metadata.ts index 8b3043c6506..c84292888e2 100644 --- a/src/locales/ne/metadata.ts +++ b/src/locales/ne/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { - title: 'Nepalese', +const metadata: PreBuiltMetadataDefinitions = { + title: 'Nepali', + code: 'ne', + language: 'ne', + endonym: 'नेपाली', + dir: 'ltr', + script: 'Deva', }; export default metadata; diff --git a/src/locales/nl/metadata.ts b/src/locales/nl/metadata.ts index d69a9a2f948..a72d9790760 100644 --- a/src/locales/nl/metadata.ts +++ b/src/locales/nl/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Dutch', + code: 'nl', + language: 'nl', + endonym: 'Nederlands', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/nl_BE/metadata.ts b/src/locales/nl_BE/metadata.ts index 6da791a1f2d..73b0f1dccd0 100644 --- a/src/locales/nl_BE/metadata.ts +++ b/src/locales/nl_BE/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Dutch (Belgium)', + code: 'nl_BE', + country: 'BE', + language: 'nl', + endonym: 'Nederlands (België)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/pl/metadata.ts b/src/locales/pl/metadata.ts index fb70cd86c9d..c9e95c34a68 100644 --- a/src/locales/pl/metadata.ts +++ b/src/locales/pl/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Polish', + code: 'pl', + language: 'pl', + endonym: 'Polski', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/pt_BR/metadata.ts b/src/locales/pt_BR/metadata.ts index 0ef5efd87f0..7feb002f955 100644 --- a/src/locales/pt_BR/metadata.ts +++ b/src/locales/pt_BR/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Portuguese (Brazil)', + code: 'pt_BR', + country: 'BR', + language: 'pt', + endonym: 'Português (Brasil)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/pt_PT/metadata.ts b/src/locales/pt_PT/metadata.ts index 020f3bbd4d5..650782074bd 100644 --- a/src/locales/pt_PT/metadata.ts +++ b/src/locales/pt_PT/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Portuguese (Portugal)', + code: 'pt_PT', + country: 'PT', + language: 'pt', + endonym: 'Português (Portugal)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/ro/metadata.ts b/src/locales/ro/metadata.ts index 711017cf4d8..e10c0d355be 100644 --- a/src/locales/ro/metadata.ts +++ b/src/locales/ro/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Romanian', + code: 'ro', + language: 'ro', + endonym: 'Română', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/ru/metadata.ts b/src/locales/ru/metadata.ts index de20840d2b5..8e6db955bac 100644 --- a/src/locales/ru/metadata.ts +++ b/src/locales/ru/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Russian', + code: 'ru', + language: 'ru', + endonym: 'Русский', + dir: 'ltr', + script: 'Cyrl', }; export default metadata; diff --git a/src/locales/sk/metadata.ts b/src/locales/sk/metadata.ts index 88e8fee4171..0bc938d168f 100644 --- a/src/locales/sk/metadata.ts +++ b/src/locales/sk/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { - title: 'Slovakian', +const metadata: PreBuiltMetadataDefinitions = { + title: 'Slovak', + code: 'sk', + language: 'sk', + endonym: 'slovenčina', + dir: 'ltr', + 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..b94b341054a 100644 --- a/src/locales/sr_RS_latin/metadata.ts +++ b/src/locales/sr_RS_latin/metadata.ts @@ -1,7 +1,14 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { - title: 'Serbian (Latin)', +const metadata: PreBuiltMetadataDefinitionsForCountry = { + title: 'Serbian (Serbia, Latin)', + code: 'sr_RS_latin', + country: 'RS', + language: 'sr', + variant: 'latin', + endonym: 'srpski (Srbija, latinica)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/sv/metadata.ts b/src/locales/sv/metadata.ts index 42fe6a4afbc..e206b2d6a09 100644 --- a/src/locales/sv/metadata.ts +++ b/src/locales/sv/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Swedish', + code: 'sv', + language: 'sv', + endonym: 'Svenska', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/th/metadata.ts b/src/locales/th/metadata.ts index 373affbd0b8..ae53d4ace60 100644 --- a/src/locales/th/metadata.ts +++ b/src/locales/th/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Thai', + code: 'th', + language: 'th', + endonym: 'ไทย', + dir: 'ltr', + script: 'Thai', }; export default metadata; diff --git a/src/locales/tr/metadata.ts b/src/locales/tr/metadata.ts index 8d914062f1a..9315cae1827 100644 --- a/src/locales/tr/metadata.ts +++ b/src/locales/tr/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Turkish', + code: 'tr', + language: 'tr', + endonym: 'Türkçe', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/uk/metadata.ts b/src/locales/uk/metadata.ts index e2d58ed341f..6f305d8920f 100644 --- a/src/locales/uk/metadata.ts +++ b/src/locales/uk/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Ukrainian', + code: 'uk', + language: 'uk', + endonym: 'Українська', + dir: 'ltr', + script: 'Cyrl', }; export default metadata; diff --git a/src/locales/ur/metadata.ts b/src/locales/ur/metadata.ts index b0610eceb55..6977c4ae110 100644 --- a/src/locales/ur/metadata.ts +++ b/src/locales/ur/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Urdu', + code: 'ur', + language: 'ur', + endonym: 'اردو', + dir: 'rtl', + script: 'Arab', }; export default metadata; diff --git a/src/locales/vi/metadata.ts b/src/locales/vi/metadata.ts index 4d8e01f00a8..abf574f3953 100644 --- a/src/locales/vi/metadata.ts +++ b/src/locales/vi/metadata.ts @@ -1,7 +1,12 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitions } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitions = { title: 'Vietnamese', + code: 'vi', + language: 'vi', + endonym: 'Tiếng Việt', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/locales/zh_CN/metadata.ts b/src/locales/zh_CN/metadata.ts index ad2dc1a3235..44f79bbee6a 100644 --- a/src/locales/zh_CN/metadata.ts +++ b/src/locales/zh_CN/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { - title: 'Chinese', +const metadata: PreBuiltMetadataDefinitionsForCountry = { + title: 'Chinese (China)', + code: 'zh_CN', + country: 'CN', + language: 'zh', + endonym: '中文 (中国)', + dir: 'ltr', + script: 'Hans', }; export default metadata; diff --git a/src/locales/zh_TW/metadata.ts b/src/locales/zh_TW/metadata.ts index 54e15cac9bf..269c4e0cb81 100644 --- a/src/locales/zh_TW/metadata.ts +++ b/src/locales/zh_TW/metadata.ts @@ -1,7 +1,13 @@ -import type { MetadataDefinitions } from '../..'; +import type { PreBuiltMetadataDefinitionsForCountry } from '../../definitions/metadata'; -const metadata: MetadataDefinitions = { +const metadata: PreBuiltMetadataDefinitionsForCountry = { title: 'Chinese (Taiwan)', + code: 'zh_TW', + country: 'TW', + language: 'zh', + endonym: '中文 (臺灣)', + dir: 'ltr', + script: 'Hant', }; export default metadata; diff --git a/src/locales/zu_ZA/metadata.ts b/src/locales/zu_ZA/metadata.ts index 3e30c09d5a8..c6553acdeef 100644 --- a/src/locales/zu_ZA/metadata.ts +++ b/src/locales/zu_ZA/metadata.ts @@ -1,7 +1,13 @@ -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', + language: 'zu', + endonym: 'isiZulu (Iningizimu Afrika)', + dir: 'ltr', + script: 'Latn', }; export default metadata; diff --git a/src/utils/merge-locales.ts b/src/utils/merge-locales.ts index e8bdef33e99..8fb531dd2be 100644 --- a/src/utils/merge-locales.ts +++ b/src/utils/merge-locales.ts @@ -14,7 +14,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) { diff --git a/test/locale-imports.spec.ts b/test/locale-imports.spec.ts index bfe639eca0b..2a691b269d4 100644 --- a/test/locale-imports.spec.ts +++ b/test/locale-imports.spec.ts @@ -29,6 +29,41 @@ 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.dir).toBeTypeOf('string'); + expect(['ltr', 'rtl']).toContain(metadata.dir); + 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