I've just started using I18n on a test application and everything is great except one thing: For the fun of it I set my Firefox user agent Accept-Language to Italian, and my page renders this: "it, hello_world." Shouldn't it say "hello, world" (the English phrase)? Does I18n force you to translate every string into language in order to use it??? I'd much rather configure it to "use English if the desired language isn't available." How do you do that?
on 2010-02-03 12:18
on 2010-02-03 12:25
I18n.t :hello_world, :default => 'Hello, world' 2010/2/3 Peter Alvin <lists@ruby-forum.com> > I'd much rather configure it to "use English if the desired language > . > For more options, visit this group at > http://groups.google.com/group/rails-i18n?hl=en. > > -- Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
on 2010-02-03 12:55
Yup, you could use default strings. Or - if it's a feature that you want in your application you can use locale fallbacks: http://github.com/svenfuchs/i18n/blob/master/lib/i...
on 2010-02-03 13:54
Sven, can you put an implementation example? Example: 1. I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) This go in Config/enviroment? 2. Then...what? 2010/2/3 Sven Fuchs <svenfuchs@artweb-design.de> > >> >> Posted via http://www.ruby-forum.com/. >> > > -- > You received this message because you are subscribed to the Google Groups > "rails-i18n" group. > To post to this group, send email to rails-i18n@googlegroups.com. > To unsubscribe from this group, send email to > rails-i18n+unsubscribe@googlegroups.com<rails-i18n%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rails-i18n?hl=en. > -- Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
on 2010-02-03 14:03
Then you have to declare the fallbacks. For example I18n.fallbacks[:es] = [:en, :fr, :de] I18n.fallbacks[:en[ = [:es, :fr, :de] etc If the es translations isn't available will pick the en one, if not the fr one ,etc -- Albert Llop Tech Department albert@kingsofmambo.com 2010/2/3 Andrés gutiérrez <andresgutgon@gmail.com>
on 2010-02-03 14:10
Thanks Albert :) This in config/enviroment.rb too? >>I18n.fallbacks[:es] = [:en, :fr, :de] >>I18n.fallbacks[:en[ = [:es, :fr, :de] 2010/2/3 Albert Llop <mrsimo@gmail.com> > Tech Department >> >>> Or - if it's a feature that you want in your application you can use >>> >>>> great except one thing: >>>> -- >>>> http://groups.google.com/group/rails-i18n?hl=en. >>> Edward V. Berard, ingeniero informático. >>> >> >> -- > -- > You received this message because you are subscribed to the Google Groups > "rails-i18n" group. > To post to this group, send email to rails-i18n@googlegroups.com. > To unsubscribe from this group, send email to > rails-i18n+unsubscribe@googlegroups.com<rails-i18n%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rails-i18n?hl=en. > -- Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
on 2010-02-03 14:20
On Feb 3, 2010, at 2:08 PM, Andrés gutiérrez wrote: > This in config/enviroment.rb too? > >>I18n.fallbacks[:es] = [:en, :fr, :de] > >>I18n.fallbacks[:en[ = [:es, :fr, :de] That should work. I'd recommend putting this kind of stuff into an initializer (e.g. config/initializers/i18n.rb) instead of environment.rb Also, maybe you want to see http://github.com/svenfuchs/i18n/blob/master/lib/i...
on 2010-02-03 14:31
Thanks Sven. For me is clear now. I'll try it. 2010/2/3 Sven Fuchs <svenfuchs@artweb-design.de> > config/initializers/i18n.rb) instead of environment.rb >> >> >>> >>>> >>>> >>>>> great except one thing: >>>>> -- >>>>> http://groups.google.com/group/rails-i18n?hl=en. >>>> Edward V. Berard, ingeniero informático. >>>> >>>> >>> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "rails-i18n" group. > To post to this group, send email to rails-i18n@googlegroups.com. > To unsubscribe from this group, send email to > rails-i18n+unsubscribe@googlegroups.com<rails-i18n%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rails-i18n?hl=en. > -- Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
on 2010-02-06 19:07
Sorry but i'm tryng this but don't work for me:
I still have no files in English translation, so I want default for
english
was Spanish
#config/initializers/i18n.rb
I18n.load_path += Dir[File.join(RAILS_ROOT, 'config', 'locales', '**',
'*.{rb,yml}')]
I18n.default_locale = :es
fallbacks = I18n.fallbacks
fallbacks.map(:en => :"es")
rails 2.3.5 and ruby 1.8.7
When i run the server:
config/initializers/i18n.rb:3: undefined method `fallbacks' for
I18n:Module
2010/2/3 Sven Fuchs <svenfuchs@artweb-design.de>
> config/initializers/i18n.rb) instead of environment.rb
>>
>>
>>>
>>>>
>>>>
>>>>> great except one thing:
>>>>> --
>>>>> http://groups.google.com/group/rails-i18n?hl=en.
>>>> Edward V. Berard, ingeniero informático.
>>>>
>>>>
>>>
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "rails-i18n" group.
> To post to this group, send email to rails-i18n@googlegroups.com.
> To unsubscribe from this group, send email to
> rails-i18n+unsubscribe@googlegroups.com<rails-i18n%2Bunsubscribe@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/rails-i18n?hl=en.
>
--
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
on 2010-02-06 20:21
I managed to fix it. I've seen the solution here [1]
The code looks like this
-------------------------------------------------------------------
#config/initializers/i18n.rb
require "i18n/backend/fallbacks"
I18n.load_path += Dir[File.join(RAILS_ROOT, 'config', 'locales', '**',
'*.{rb,yml}')]
I18n.default_locale = :es
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
-------------------------------------------------------------------
What I needed was to install the gem of sven i18n. But why?
I think rails 2.3.5 that came with native support for internationalizing
the
App
sudo gem install i18n
Successfully installed i18n-0.3.3
[1] http://wiki.github.com/svenfuchs/i18n/fallbacks
El 6 de febrero de 2010 19:05, Andrés gutiérrez
<andresgutgon@gmail.com>escribió:
>
>> This in config/enviroment.rb too?
>> http://github.com/svenfuchs/i18n/blob/master/lib/i...
>>> etc
>>>
>>>>
>>>>>
>>>>>
>>>>>> For the fun of it I set my Firefox user agent Accept-Language to
>>>>>> --
>>>>>> http://groups.google.com/group/rails-i18n?hl=en.
>>>>> Edward V. Berard, ingeniero informático.
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>> --
>
>
> --
> Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
>
> -----------------------------------------------------------------------------
> "Caminar sobre el agua y desarrollar software a partir de unas
> especificaciones es fácil. si ambas están congeladas."
> Edward V. Berard, ingeniero informático.
>
--
Experiencia es lo que obtienes, cuando no obtienes lo que quieres.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.