Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Ignored Deployments
|
| defaultValue={languageCustomLabels[countryCode] ?? t`Select a language...`} | ||
| options={[isWeb ? '' : 'DD', ...supportedCountryCodes]} // empty string breaks on native | ||
| defaultValue={languageLabels[countryCode] ?? t`Select a language...`} | ||
| options={[isWeb ? '' : 'DD', ...countryCodes]} // empty string breaks on native |
There was a problem hiding this comment.
why we still using this 'DD' ? empty value should mean 'system default'.
There was a problem hiding this comment.
We removed it but I had to turn it back here (on android)
the component is not able to handle a empty string when rendered on android (as comment points out)
| const { containerStyles, textStyles, children } = props | ||
| const { children: countryCode } = children.props | ||
| const countryLabel = languageCustomLabels[countryCode] ?? 'Device Default' | ||
| const countryLabel = languageLabels[countryCode] ?? 'Device Default' |
There was a problem hiding this comment.
declare
const getLabel = code => languageLabels[code] ?? t`Device default`
helper outside component and use it
| const { locales, sourceLocale } = package.lingui | ||
|
|
||
|
|
||
| const lcid = require('windows-locale') |
There was a problem hiding this comment.
you don't need the whole list.
lingui is actually based over Android-supported locales which are: https://developers.google.com/interactive-media-ads/docs/sdks/android/client-side/localization
(just the underscore char is replaced via dash)
There was a problem hiding this comment.
here I started an whole map:
const locales = {
af: {
label: "Afrikaans",
countryCode: "ZA"
},
am: {
label: "ኣማርኛ",
countryCode: "ET"
},
ar: {
label: "العربية الفصحى",
countryCode: "AE"
},
ar_eg: {
label: "عربى",
countryCode: "EG"
},
ar_sa: {
label: "العربية الفصحى",
countryCode: "SA"
},
eu: {
label: "Euskara",
countryCode: "ES"
},
be: {
label: "Беларуская",
countryCode: "BY"
},
bn: {
label: "Bengali",
countryCode: null
},
bg: {
label: "Bulgarian",
countryCode: null
},
ca: {
label: "Catalan",
countryCode: null
},
zh: {
label: "Chinese (Simplified)",
countryCode: null
},
zh_cn: {
label: "Chinese (Simplified, China)",
countryCode: null
},
zh_hk: {
label: "Chinese (Traditional, Hong Kong)",
countryCode: null
},
zh_tw: {
label: "Chinese (Traditional, Taiwan)",
countryCode: null
},
hr: {
label: "Croatian",
countryCode: null
},
cs: {
label: "Czech",
countryCode: null
},
da: {
label: "Danish",
countryCode: null
},
nl: {
label: "Dutch",
countryCode: null
},
en: {
label: "English",
countryCode: null
},
en_au: {
label: "English (Australia)",
countryCode: null
},
en_ca: {
label: "English (Canada)",
countryCode: null
},
en_gb: {
label: "English (United Kingdom)",
countryCode: null
},
en_ie: {
label: "English (Ireland)",
countryCode: null
},
en_in: {
label: "English (India)",
countryCode: null
},
en_sg: {
label: "English (Singapore)",
countryCode: null
},
en_za: {
label: "English (South Africa)",
countryCode: null
},
et: {
label: "Estonian",
countryCode: null
},
fa: {
label: "Farsi",
countryCode: null
},
fil: {
label: "Filipino",
countryCode: null
},
fi: {
label: "Finnish",
countryCode: null
},
fr: {
label: "French",
countryCode: null
},
fr_ca: {
label: "French (Canada)",
countryCode: null
},
fr_ch: {
label: "French (Switzerland)",
countryCode: null
},
gl: {
label: "Galician",
countryCode: null
},
de: {
label: "German",
countryCode: null
},
de_at: {
label: "German (Austria)",
countryCode: null
},
el: {
label: "Greek",
countryCode: null
},
gu: {
label: "Gujarati",
countryCode: null
},
he: {
label: "Hebrew",
countryCode: null
},
hi: {
label: "Hindi",
countryCode: null
},
hu: {
label: "Hungarian",
countryCode: null
},
is: {
label: "Icelandic",
countryCode: null
},
id: {
label: "Indonesian",
countryCode: null
},
it: {
label: "Italian",
countryCode: null
},
ja: {
label: "Japanese",
countryCode: null
},
kn: {
label: "Kannada",
countryCode: null
},
ko: {
label: "Korean",
countryCode: null
},
lo: {
label: "Lao",
countryCode: null
},
lv: {
label: "Latvian",
countryCode: null
},
ln: {
label: "Lingala",
countryCode: null
},
lt: {
label: "Lithuanian",
countryCode: null
},
ms: {
label: "Malay",
countryCode: null
},
ml: {
label: "Malayalam",
countryCode: null
},
mr: {
label: "Marathi",
countryCode: null
},
no: {
label: "Norwegian",
countryCode: null
},
pl: {
label: "Polish",
countryCode: null
},
pt: {
label: "Portuguese",
countryCode: null
},
pt_br: {
label: "Portuguese (Brazil)",
countryCode: null
},
pt_pt: {
label: "Portuguese (Portugal)",
countryCode: null
},
ro: {
label: "Romanian",
countryCode: null
},
ru: {
label: "Russian",
countryCode: null
},
sr: {
label: "Serbian",
countryCode: null
},
sk: {
label: "Slovak",
countryCode: null
},
sl: {
label: "Slovenian",
countryCode: null
},
es: {
label: "Spanish",
countryCode: null
},
es_419: {
label: "Spanish (Latin America)",
countryCode: null
},
es_ar: {
label: "Spanish (Argentina)",
countryCode: null
},
es_cl: {
label: "Spanish (Chile)",
countryCode: null
},
es_co: {
label: "Spanish (Colombia)",
countryCode: null
},
es_cr: {
label: "Spanish (Costa Rica)",
countryCode: null
},
es_do: {
label: "Spanish (Dominican Republic)",
countryCode: null
},
es_ec: {
label: "Spanish (Ecuador)",
countryCode: null
},
es_sv: {
label: "Spanish (El Salvador)",
countryCode: null
},
es_gt: {
label: "Spanish (Guatemala)",
countryCode: null
},
es_hn: {
label: "Spanish (Honduras)",
countryCode: null
},
es_mx: {
label: "Spanish (Mexico)",
countryCode: null
},
es_ni: {
label: "Spanish (Nicaragua)",
countryCode: null
},
es_pa: {
label: "Spanish (Panama)",
countryCode: null
},
es_pe: {
label: "Spanish (Peru)",
countryCode: null
},
es_pr: {
label: "Spanish (Puerto Rico)",
countryCode: null
},
es_py: {
label: "Spanish (Paraguay)",
countryCode: null
},
es_us: {
label: "Spanish (United States)",
countryCode: null
},
es_uy: {
label: "Spanish (Uruguay)",
countryCode: null
},
es_ve: {
label: "Spanish (Venezuela)",
countryCode: null
},
sw: {
label: "Swahili",
countryCode: null
},
sv: {
label: "Swedish",
countryCode: null
},
gsw: {
label: "Swiss German",
countryCode: null
},
tl: {
label: "Tagalog",
countryCode: null
},
ta: {
label: "Tamil",
countryCode: null
},
te: {
label: "Telugu",
countryCode: null
},
th: {
label: "Thai",
countryCode: null
},
tr: {
label: "Turkish",
countryCode: null
},
uk: {
label: "Ukrainian",
countryCode: null
},
ur: {
label: "Urdu",
countryCode: null
},
vi: {
label: "Vietnamese",
countryCode: null
},
zu: {
label: "Zulu",
countryCode: null
}
}how to fill it
- look at English name, find translation at https://www.omniglot.com/language/names.htm , fill own name in 'label' prop
- click on the locale own name at this site, you will see detailed article above language and in which country (ies) it's used.
- pick up the proper country code from here https://countrycode.org
you could ask @patpedrosa to do it or work on it if you don't have more prioritised tasks
for now I suggest to fill this map with languages we currently support only then merge PR and open a task to fill the whole list
78b48f6 to
0ea4920
Compare
|
@decentralauren can you decide if there is still a priority or need for this? There was a request made to make the languages shown in settings to be translated to their native representation |
Description
dynamically load language label and country code maps based on supported lingui locales
About # (link your issue here)
#4074
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: