I have the php intl extension installed for normalizing strings and to retrieve language names and country names for the selected language. I have 2 select boxes, one to select a country where the person currently is and to select a language for the site. Now I have used the function _() to translate the site.
Now when I do ./locale -a to see all supported languages and when I match this with the locales supported by the intl extension (intlcal_get_available_locales()) there are a lot of differences. I have tried to map these and this kinda works, but I can't believe that this is the preferred method to do this.
I am struggling with this for a very long time. How can I best solve this. What am I doing wrong? Is there a best way to do localization and translation.
For every possible country in ISO 3166 I have mapped the locales from the intl extension to it. For countries which aren't listed in the intl extension I have mapped them myself. For example country code AQ I have mapped it to nb_NO. I also have tried to map a primary locale to every country which has multiple locales.
The following problems I came across are:
If I want to support the arabic language (ar), there is nog ar_AR, so I have to use for example ar_AE to use in setlocale, otherwise I can't set the translations there for ar.
The locale mn_MN is supported in setlocale, but it isn't supported in the intl extension.