Wait, there has been some change. Read this: http://groups.google.com/group/rails-i18n/t/103b9c555b6fb54e?hl=en
In environment it should read something like I18n.load_path = RAILS_ROOT + '/lang' I haven't tried it before. On Oct 2, 9:01 pm, "Iain Hecker" <[EMAIL PROTECTED]> wrote: > Hi, > > You're missing a few parts. First is the loading of the files into > I18n. Put this into your environment: > > I18n.load_translations(*Dir.glob(LOCALES_DIRECTORY+'/**/*.yml')) > > look here how to get > available_locales:http://rails-i18n.org/wiki/pages/i18n-available_locales(put > it in an > initializer) > > Secondly, you need to set the proper locale at every request, so in > your before_filter you need to default to the locale stored in the > user's session or from preferences stored in the database. > > def set_locale > I18n.locale = params[:locale] or session[:locale] or I18n.default_locale > session[:locale] = I18n.locale > end > > Hope this helps, > > Iain > > On Thu, Oct 2, 2008 at 19:14, Redd Vinylene <[EMAIL PROTECTED]> wrote: > > > Hello hello! I just finished translating my app, however my > > translations won't load. So first, what am I doing wrong? And second, > > is there anything that can be done better? I'm a bit confused since > > every tutorial and demo app seems to have its own way of doing things. > > Alright, that's it. Thanks everyone! > > > /myapp > > /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.default_locale = "en" > > > LOCALES_DIRECTORY = "#{RAILS_ROOT}/lang/" > > > LOCALES_AVAILABLE = Dir["#{LOCALES_DIRECTORY}/*/*.yml"].collect do > > |locale_file| > > File.basename(locale_file, ".yml") > > end.uniq > > > ## /myapp/app/controllers/application.rb > > > before_filter :set_locale > > > def set_locale > > I18n.locale = params[:locale] if params[:locale] > > 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(LOCALES_AVAILABLE, I18n.locale) %> > > > -- > >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 -~----------~----~----~----~------~----~------~--~---
