Jump to content

The ultimate community for Ruby on Rails developers.


Photo

i18n: separating language from region

i18n

  • Please log in to reply
No replies to this topic

#1 starfry

starfry

    Signalman

  • Members
  • 11 posts

Posted 21 December 2013 - 11:28 AM

Hello, I'd like some guidance to help me take the correct path to internationalise my app.

 

I have set up i18n locales and these work fine. I need to cater for regional differences separately from language. For example, in the UK the currency symbol is £ and the language is English and in Ireland the currency symbol is € and there are English and Gaelic languages to consider.

 

So, I need to use my :en locale for the English language but have separate regions that use the same locale for language but have different currency and date settings.

 

I have read the many discussions[1] that led to Rails's "pragmatic use"[2] use of only the language portion of the locale tag but I am left unclear on how to go about catering for a one to many mapping between regions and languages whilst being DRY.

 

[1] https://groups.googl...18n/FN7eLH2-lHA t

[2] http://guides.rubyon....3.11/i18n.html

 

Attempting not to deviate from the Rails default, I've written some code that allows the user to select a region and this then sets the available locales and, if there are many, the user may select from them. So, in my example users of the UK site would get English and no choice but users of the Irish site would could choose between English and Gaelic. But, with rails getting currency information from the selected locale, it doesn't fully solve the problem.

 

If I could tell Rails to use a different file for regional data (currencies, etc) then I think I should be able to make what I've done work.

 

How do people do this? Any insight would be much appreciated.







Also tagged with one or more of these keywords: i18n

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users