Reputation: 186562
I'm implementing the routing and i18n part of my framework. I'm wondering if I should assume that
^[a-z]{2}
Will be a locale, and if so use it. Or should I make the user populate a list with languages? Eg:
supported = [ 'en', 'es', 'it', 'ru', ]
So the developer has to manually define languages. And for the record, 90% of the sites here only use en
only.
Upvotes: 0
Views: 102
Reputation: 56500
ISO 639 is the language code specs - but it defines more than one way
However is language actually a locale? EN for example most certainly isn't. Being British I want EN-UK content first, but I'm in the US. This means google redirects me to google.co.uk which is certainly not what I want.
Upvotes: 3
Reputation: 375574
Keep in mind that some languages need more than two characters to specify. Simplified Chinese is often "zh-CN" or "zh-HANS", and Traditional Chinese is "zh-TW" or "zh-HANT". Brazilian Portuguese is "pt-BR", and so on.
Upvotes: 3