You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the locales folder, you put files of the message bundle, e.g. en-US.ts, zh-CN.json, or fr.js. The format is generally 2-letter language code (ISO 639-1), followed by base separator - or _, and then an optional 2-letter region code (ISO 3166-1 alpha-2). However, Filipino has a language code of fil, which is 3 letters (ISO 639-2). So naming a file fil.js will not get picked up.
The reason for this is that the code currently uses a regex that assumes 2-letter language code.
Enhance the code to use a regex that supports Unicode LDML. In addition to supporting 2 or 3-letter language code (e.g. zh, fil, en), it allows for optional script tag, so sr-Latn and sr-Cyrl (Serbian written in Latin and Cyrillic respectively) would be supported, and the region code can either be 2 letters or 3 digits, e.g. es-419 which is Spanish as spoken in Latin America.
Additional context
There is ietf-language-tag-regex library which provides a regex to match on IETF BCP 47 which is the basis for Unicode LDML.
The text was updated successfully, but these errors were encountered:
That is currently what I am doing, but I have to transform the value to the correct fil when I send the locale code to our API headers. I also synchronize the message bundles to SimpleLocalize (which uses Google Translate and expects the code to be fil) and have to rename the folder to fil, perform the sync, then rename the folder back to tl_PH. I could automate that with a script, but I'd rather spend time implementing a proper fix.
Background
In the
locales
folder, you put files of the message bundle, e.g.en-US.ts
,zh-CN.json
, orfr.js
. The format is generally 2-letter language code (ISO 639-1), followed by base separator-
or_
, and then an optional 2-letter region code (ISO 3166-1 alpha-2). However, Filipino has a language code offil
, which is 3 letters (ISO 639-2). So naming a filefil.js
will not get picked up.The reason for this is that the code currently uses a regex that assumes 2-letter language code.
umi/packages/plugins/src/utils/localeUtils.ts
Lines 90 to 92 in 35be997
Proposal
Enhance the code to use a regex that supports Unicode LDML. In addition to supporting 2 or 3-letter language code (e.g.
zh
,fil
,en
), it allows for optional script tag, sosr-Latn
andsr-Cyrl
(Serbian written in Latin and Cyrillic respectively) would be supported, and the region code can either be 2 letters or 3 digits, e.g.es-419
which is Spanish as spoken in Latin America.Additional context
There is ietf-language-tag-regex library which provides a regex to match on IETF BCP 47 which is the basis for Unicode LDML.
The text was updated successfully, but these errors were encountered: