Short answer is NO, you are NOT doing it right.
You do not need to put anything into application.rb.
environment.rb needs only this:
I18n.load_path = Dir.glob("#{RAILS_ROOT}/lang/**/*.yml")
I18n.default_locale = "en"
On Oct 7, 2:18 pm, "Redd Vinylene" <[EMAIL PROTECTED]> wrote:
> Okay guys, here's the latest. I hope I've got it right this time.
>
> Also:
>
> 1. Will I (in Preferences#edit) be able to choose locale from a select
> box, like in Clemens Kofler's demo? I don't think I need any of that
> URL stuff. I just want it plain and simple, one language only.
>
> 2. Is the organization of my locales proper? Or must en.yml,
> en_about.yml and en_app.yml be put into a single file for the
> Preferences#edit select box to work?
>
> The following is also available athttp://pastie.org/286698
>
> /myapp
> /myapp/app/controllers/application.rb
> /myapp/app/helpers/application_helper.rb
> /myapp/app/views/admin/preferences/edit.html.erb
> /myapp/config/environment.rb
> /myapp/config/initializers/i18n.rb
> /myapp/lang
> /myapp/lang/en
> /myapp/lang/en/en.yml
> /myapp/lang/en/en_about.yml
> /myapp/lang/en/en_app.yml
> /myapp/lang/is/is.yml
> /myapp/lang/is/is_about.yml
> /myapp/lang/is/is_app.yml
>
> ## /myapp/config/environment.rb
>
> I18n.load_path = RAILS_ROOT + "/lang"
>
> I18n.default_locale = "en"
>
> ## /myapp/config/initializers/i18n.rb
>
> module I18n
> class << self
> def available_locales
> backend.available_locales
> end
> end
>
> module Backend
> class Simple
> def available_locales
> translations.keys
> end
> end
> end
> end
>
> ## /myapp/app/controllers/application.rb
>
> before_filter :set_locale
>
> def set_locale
> I18n.locale = extract_locale_from_params || "en"
> end
>
> ## /myapp/app/helpers/application_helper.rb
>
> def t(*args)
> translate(*args)
> end
>
> ## /myapp/app/views/admin/preferences/edit.html.erb
>
> <%= f.label "locale", t(:"locale") %><%= f.select("locale",
> options_for_select(I18n.available_locales) %>
>
> --http://www.home.no/reddvinylene
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---