Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify language codes in the i18n file names. #395

Open
dariuszdawidowski opened this issue Jan 5, 2024 · 4 comments
Open

Unify language codes in the i18n file names. #395

dariuszdawidowski opened this issue Jan 5, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@dariuszdawidowski
Copy link

I think it would be better to use ISO language codes for all file names in emoji-picker-element/i18n/*.js so it would be easy to use with window.navigator.language. At this moment some of them has double ISO name like pt_BR, some not like: pl, en, etc.

@nolanlawson
Copy link
Owner

Yeah this is a historical result of which languages folks decided to add translations for. And some of the translators decided to specify e.g. Brazilian Portuguese rather than just Portuguese. (I'm not an expert on Portuguese, so I deferred to the translator's judgment.)

There is also some trickiness with "languages" with vastly different writing systems or vocabulary. Like we have zh_CN but if we had traditional Chinese or Cantonese it would probably look very different.

@nolanlawson nolanlawson added the enhancement New feature or request label Jan 7, 2024
@nolanlawson
Copy link
Owner

nolanlawson commented Jan 7, 2024

BTW this would be a breaking change. Assuming what you're asking for is for all the language codes to just be the two-letter version and not the double ISO names?

@dariuszdawidowski
Copy link
Author

BTW this would be a breaking change. Assuming what you're asking for is for all the language codes to just be the two-letter version and not the double ISO names?

I think double ISO names are better. Broser variable window.navigator.language already contains double name (but with dash not underscore) this could be used directly to initialize language.

@akkie
Copy link

akkie commented Apr 19, 2024

You should differentiate here between language and locale. An iso language code is a two letter code like "de", "en" and so on. A locale code consists of a language and a country (region). This is needed to distinguish between countries and languages. As example english is spoken in multiple countries. So as example we have en-GN and en-US. If you now want to display special units for number values, there might be different rules for US and GB. Therefore a locale is needed here. If you only want to translate things without applying special rules to numbers or dates, ..., the two character language code is enough. Regarding a underscore or hyphen in locale codes. Based on RFC 4646 the hyphen is the standard. But codes with underscore are also used frequently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants