Reputation: 2494
I have this app in which I use a bunch of locales (which are adjusted to be more suited to the domain of the app, ex: instead of using es-MX, I just use mx as locale)
And I have configured the fallbacks in application.rb
config.i18n.default_locale = :en
config.i18n.fallbacks = {
# sites
'cl' => 'es',
'mx' => 'es',
'lat' => 'es',
'br' => 'en',
'us' => 'en',
# lang
'es' => 'en',
'pt' => 'br',
}
And I set the locale by url ex: localhost:3001/cl (for chilean locale)
here's my code in app_controller
before_filter :set_locale
private
def set_locale
if supported_locale?(params[:locale])
I18n.locale = params[:locale]
end
end
And my routes
# public urls for sites
scope '/:locale' do
# index
match '/' => 'main#index', via: :get, as: :site
end
So, the thing is when I am in production I have localhost:3001/cl and it calls the _logo.cl.html.erb partial and the locale printed in the console it's cl. But the text are still in english. And in development everything works fine. Anyone has any idea about this?
I'll leave a couple of images
production/us production/cl development/cl
Upvotes: 3
Views: 582
Reputation: 2494
The thing was that the production.rb
file define
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
overwriting the custom fallback rules that I had defined in application.rb
and I just remove those lines and the problem was solved
Upvotes: 3