ruby-on-rails – "jp" should be an abbreviation of Japan defined by ISO3166, but the reason why `ja.yml` is used

Question: Question:

In Rails i18n , ja.yml is used as a Japanese configuration file, but it seems to be jp by the definition of ISO 3166.

https://en.wikipedia.org/wiki/ISO_3166

Is ja something specified somewhere?
I would like to know if there is anything other than ja that is out of the definition of ISO 3166.

Answer: Answer:

According to rails-i18n 's README.md, refer to the iso library for a list of valid language / region codes. The iso library uses two lowercase letters as the language code under ISO 639-1 alpha2 and two uppercase or three letters (based on UN M49) as the regional code under ISO 3166-1 . Combine them and use the言語コードor言語コード-地域コードas a tag.

From the above story, there should be no problem with "ja-JP" other than "ja" in Japanese. In fact, anything else works as long as you don't need to use translated data such as rails-i18n. However, the translated data of each library uses Japanese as "ja", so if you want to use it, you just need to match it with "ja". See the Available Locales in the README.md of rails-i18n for a translated list.

There are IETF language tag languages ​​and language-regions as standards, but it seems that this standard is not adopted.

Scroll to Top