[openstreetmap/openstreetmap-website] Show diary languages in users language (#2298)

Tom Hughes notifications at github.com
Wed Jul 3 12:01:53 UTC 2019


I can't comment on the I18n data but I'm pretty familiar with CLDR and would generally expect it to give reasonable answers where it gives any answer at all.

To explain a little bit about language codes, there are a few variations depending on whether you're dealing with IANA BCP47 codes or CLDR ones and so on but broadly speaking a full language code looks something like:

```
language-Script-REGION-VARIANT
```

Where language is a two or three letter language code, normally in lowercase; script is a four letter script code, normally in mixed case; region is a two letter country code, normally in upper case; and variant is one of more variant tags each of 5 to 8 characters and normally in mixed case.

Either hyphen or underscore is used as the separator and any component after the first can be left out in which case CLDR has a table that tells you what value to assume (the "likely subtag" table).

So the full name of British English would be `en-Latn-GB` but as latin is the only script ever used that is normally left out.

It gets fun with Chinese where `zh-Hans` is simplified Chinese (with no specific region) and `zh-Hant` is traditional Chinese (with no specific reason) but there is a long history of actually using `zh-CN` and `zh-TW` for those as we do.

The likely expansion for `be` in CLDR is `be-Cyrl-BY` which is the Belarussian written in Cyrillic as used in Belarus. The `Tarask` is actually a variant tag that selects an alternate orthography.

We have code in `lib/locale.rb` that attempts to select the best match for a given language code against a set of available codes - that was written by me after I gave up attempting to get the HTTP accept language parsing gem improved. It's not as good as it could be with access to the CLDR data tables...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/2298#issuecomment-508063880
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20190703/d6273968/attachment.html>


More information about the rails-dev mailing list