Search code examples
phpstandardsisointl

ISO 639 - Reliable Lookup Resource in PHP


Intl Extension Uses The RFC 4646 Language Tag

In the PHP intl extension, specifically the Locale class, it says:

Locales are identified using RFC 4646 language tags

RFC 4646 is deprecated

The reason I mention this is that RFC 4646 has been deprecated in favour of RFC 5646.

I had intended to use the intl extension to translate ISO 639 codes to their respective language name (e.g. en to English). Whilst this is not essential, it would be a helpful ability to have available.

ISO 639 changes frequently

The 639 language codes are actively maintained and altered by their respective registration authorities. This is not a hypothetical concern either, just see the change-log for ISO 639-3.

The use of the now deprecated language tag leaves me a little concerned about how actively the intl extension is being maintained; RFC 5656 was released in 2009, this is hardly a cutting edge standard.

Question

  • Are the ISO-639 language codes used by intl updated regularly?
  • Can intl be relied upon as an authoritative lookup resource for ISO 639?
  • If not, is there an authoritative lookup resource for ISO 639 in PHP?

Solution

  • The intl extension relies on ICU to supply language codes, among other things. The ICU version is stored in the constant PHP_ICU_VERSION. ICU itself relies on the Unicode Common Locale Data Repository (CLDR) as specified in the same documentation you cited in the Locale class: "The extensions used by CLDR in [Unicode Standard Annex] #35 (and inherited by ICU) are valid and used wherever they would be in ICU normally."