Re: I18Nv2 - get locale from language/country
| From: | Michael Wallner | Date: | Thu, 03 Mar 2005 13:55:19 +0000 |
| Subject: | Re: I18Nv2 - get locale from language/country | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-36506@lists.php.net to get a copy of this message | ||
Hi Andreas Korthaus, you wrote:
> Michael Wallner wrote:
>>
>> As long as you're using locales which I18Nv2 knows of (only
>> important for Windows -- or which are installed on your Linux
>> machine) - yes.
>
>
> How could I check if a locale is supported on a system?
C:\>php -r "var_dump(setlocale(LC_ALL,'de'));"
bool(false)
C:\>php -r "var_dump(setlocale(LC_ALL,'deu'));"
string(19) "German_Germany.1252"
s1-iw:~$ /usr/bin/php -r 'var_dump(setlocale(LC_ALL, "de"));'
bool(false)
s1-iw:~$ /usr/bin/php -r 'var_dump(setlocale(LC_ALL, "de_DE"));'
string(5) "de_DE"
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
locale -a will give you all available locales on a Linux machine.
>> I suppose, negotiating the locale at the first
>> visit, providing a drop-down or similar and storing the preferred
>> language/locale in the session/db, to be common practice.
>
>
> My problem is _what_ to provide in these drop-downs, so that every user
*Now* I get you :)
> understands what to do. At the moment I have a drop-down for the
> language of the software (for translation), and I have a drop-down for
> the country which belongs to the users address. But I have to avoid
> invalid combinations of these two values, if I use these as locale
> later. But this is not allways possible. If I am german and work for a
> company in United States, my selected language is "de" and my selected
> country is "US". So I get the locale "de_US", which is not valid I think
> ;-)
>
> So if this is common practice, what is the typical content of such
> drop-downs? Or do you know a good Example?
>
> Firefox uses something like:
>
> Language
> --------
> [...]
> German [de]
> German/Germany [de_DE]
> German/Austria [de_AT]
> English [en]
> English/Great Britain [en_GB]
> English/United States [en_US]
> [...]
>
> But I don't like it so much for a web-application.
If you know of a "language => country" map or if you are going to
write one up, that would be of really great use :)
Regards,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc