This project is archived and is in readonly mode.

#2637 ✓ wontfix
calavera

I18n, look up a translation with the default locale when it's missed with another specific locale

Reported by calavera | May 12th, 2009 @ 04:13 PM | in 2.x

I've added an I18n option to allow to look up a translation with the default locale when it's missed with another specific locale.

This is a useful option if you don't want your page will crash when misses a translation and you don't want to use the default option in each translation. It's inspired by the gettext behaviour.

For example, I have this code in an initializer:


  I18n.use_default_locale_on_missing_translation = true
  I18n.default_locale = :en

And two translation files, en.yml and es.yml:


  en:
    hello: 'hello'
    hello_world: 'hello world'
 
  es:
    hello_world: 'hola mundo'

When I execute this code:


  I18n.t :hello, :locale => :es

Rails returns hello instead of send an error

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

Attachments

Pages