MailingList


Re: Getting the iso-639-1 Language code from a Country

by Daniel Dias :: Rate this Message:

Reply to Author | View in Thread

Thanks for the quick reply Chris.

I thought it was possible to dynamically "guess" the user's language but it's not so simple. Having a default_lang per country like you suggest won't work in my case since I do have to handle more than one lang by country.

Anyway, I solved the problem adding an extra attribute "native_language" to the User model witch will be filled by the user itself.

--
Daniel Dias


On Mon, Mar 3, 2008 at 4:55 PM, Chris Hapgood <cch1@...> wrote:
Daniel,
This subject was quite topical last year when I submitted some patches to Globalize.  There is, of course, a big problem in that the mapping of Country->Language is not 1:1.  Think Canada, Switzerland, China, etc.  So there will be no perfect solution.  Instead, I believe that we considered a default language per country that could optionally be setup in the database.
 
AFAIK, nothing became of those discussions.
 
-Chris
 
Chris Hapgood
Phone: +1 434 989 8584
Skype: chris.hapgood
Email: cch1@...
 


From: Daniel Dias [mailto:lupeke@...]
Sent: Monday, March 03, 2008 13:59
To: users@...
Subject: Getting the iso-639-1 Language code from a Country

Hi.

I need to change the Locale in my application according to the current user Country (user is logged in and country_id available through the active session). Looking inside globalize's code and after same research I still can't figure out a way to get the iso-639-1 language code from one country.

Making an association between Languages and Countries could work, but it's hard and I don't think it's the better solution.

Any help will be appreciated.

Thanks.

--
Daniel Dias

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.3/1307 - Release Date: 02/03/2008 15:59


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.21.3/1307 - Release Date: 02/03/2008 15:59





 « Return to Thread: Getting the iso-639-1 Language code from a Country