Well, there is nothing special about it I think.
Both files "en.yml" and "fr.yml" are in /config/locales (default path).
If I put the content of the fr file into the en.yml file, the french
translations are found.
So I guess the fr.yml is well formed.
fr:
login: Login
new_account: Créer un nouveau compte
etc .....
The code in environment.rb:
# The internationalization framework can be changed to have another
default locale (standard is :en) or more load paths.
# All files from config/locales/*.rb,yml are added automatically.
# config.i18n.load_path += Dir[File.join(RAILS_ROOT, 'config',
'locales', '*.{rb,yml}')]
config.i18n.default_locale = 'en'
My code in the application.rb controller:
before_filter :set_locale
def set_locale
return if not params[:locale]
locale = session[:locale] || I18n.default_locale
locale = (locale=='en'? 'fr':'en')
session[:locale] = I18n.locale = locale
end
Thanks for your input,
Mickael Faivre-Maçon
On Sat, Dec 27, 2008 at 4:09 PM, Sébastien Grosjean - ZenCocoon
<[email protected]> wrote:
>
> Well I've this behavior working fine on my side.
>
> Can you send more details about your fr.yml file.
>
> Warm regards,
> --
> Sebastien Grosjean - ZenCocoon
>
> On Dec 25, 6:31 pm, MickTaiwan <[email protected]> wrote:
>> Yeah, me either.....
>> (I restarted the server...)
>> Mickael.
>>
>> > I can't think of any reason why it shouldn't load. The only thing that
>> > you need to remember is that you need to restart your Rails server,
>> > because the load_paths are only checked at startup.
>>
>> > Best wishes,
>>
>> > Iainhttp://iain.nl
>>
>> > On Dec 25, 10:58 am, MickTaiwan <[email protected]> wrote:
>>
>> > > Hi,
>>
>> > > If I put my 2 locales en and fr in one file (config/locales/en.yml)
>> > > english an french locales are loaded and I can switch between the two.
>>
>> > > But if I put the french local in a separate fr.yml file, then I get
>> > > "translation missing: fr, email" errors.
>>
>> > > My configuration.rb has:
>> > > config.i18n.load_path += Dir[File.join(RAILS_ROOT, 'config',
>> > > 'locales',
>> > > '*.{rb,yml}')]
>>
>> > > Could someone explain this ?
>>
>> > > Thanks for any help,
>> > > Mickael.
>>
>>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"rails-i18n" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rails-i18n?hl=en
-~----------~----~----~----~------~----~------~--~---