berk / tr8n

This repository has moved to:
https://github.com/tr8n/tr8n
MIT License
279 stars 37 forks source link

Special status of en-US #20

Open rbjarnason opened 13 years ago

rbjarnason commented 13 years ago

Our default language is 'en' but I can see 'en-US' hardcoded in quite a bit of places. What is the significant of en-US and the reason why its hardcoded?

I have changed it for this function to 'en' but considering if I should change it in the views as well.

def self.multiple_base_languages? 'en' == default_locale end

berk commented 13 years ago

Thank you for pointing this out. It is a bug. We should have used a configurable variable for the base admin language instead of hardcoding it. 'en-US' is hardcoded in all the admin pages to indicate that the base language of those pages is indeed English. Tr8n does not force a site to use English as the default site language. So you could specify that your default language is French. But this creates a situation now that your site has multiple base languages (all of the site is in French, yet the admin tools are in English). When you switch your language to French, you can translate all of the admin tools from English to French, and when you switch your language to English, you can translate the rest of the site to English, but not the admin tools, since they are already in English.

In general, you can have as many base languages as you would like. You just have to specify them in the options of the "tr" method calls.

But since your base language is 'en', it creates a confusing situation as it treats 'en-US' as a different language from plain 'en'. The best way of fixing this would be to have a configurable option that would contain the language of the admin tools. Many sites use 'en-US' as the default locale, and those sites would continue using 'en-US', but in your case you could disable the 'en-US' and use plain 'en' instead.

Does this make sense? Could you make this change and send me a pull request?

I will start moving tr8n to Rails 3 as soon as i get some free time. It was not a priority for us yet. But it looks like there is a lot of demand for it, so i will make it a priority.

rbjarnason commented 13 years ago

Thanks for the explaination, I will add it to the config and send you a pull request. I'm running on Rails 3 and with some minor fixes it all seems to work fine and not an unbearable amount of deprecation warnings.

philister commented 12 years ago

Hi, we are still using rails2 and some 2.1 pre version of tr8n. Could you give me a hint, how to solve the problem by myself?

Thank and regards, Phil

PS Great plugin, we are happy to use it at pictrs.com