vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.71k stars 274 forks source link

[Request] Allow using IETF language tag as language identifier in PO file #774

Closed sergioisidoro closed 1 year ago

sergioisidoro commented 1 year ago

We're trying to standardise language codes across our projects, and we're trying to use the IETF language tags and the ISO standards for such.

However, PoEdit uses a _ instead of - for the language, and every time we save the file, Poedit changes the language string back to the _ again.

Desired >> "Language: fi-FI\n"
Changes to >> "Language: fi_FI\n"

This ends up compiling (gettext js tools) to a translation file that has the code with _, and hence invalid in our project, and we need to change the language by hand every time we make an edit. (these tools are generally agnostic to the actual language string, and will just use whatever we provide them as a key string)

All the information I found points to the use of the - as the standard.

Each language tag is composed of one or more "subtags" separated by hyphens (-). Each subtag is composed of basic Latin letters or digits only.

from https://en.wikipedia.org/wiki/IETF_language_tag

I'm pretty sure "-" is the standard. If you see "_" somewhere it's probably something some people came up with to make it a valid identifier.

from https://stackoverflow.com/questions/4904803/en-us-or-en-us-which-one-should-you-use

I'm wondering if it is possible to consider in future releases to include a setting in the Advanced settings like "use IETF language codes in PO file"

vslavik commented 1 year ago

However, PoEdit uses a instead of - for the language, and every time we save the file, Poedit changes the language string back to the again.

That would be because that's the gettext file format. RTFM: https://www.gnu.org/software/gettext/manual/html_node/Header-Entry.html

The problem is in your project expecting spec-violating, i.e. invalid, input and not in Poedit.