-
-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(locale): add additional metadata properties (#2025)
- Loading branch information
1 parent
ed19bef
commit a49aa0d
Showing
67 changed files
with
569 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string, unknown>; | ||
/** | ||
* 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<PreBuiltMetadataDefinitionsForCountry>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
Oops, something went wrong.