Closed wvengen closed 11 years ago
U can use I18n.available_locales for the dropdown. application_controller is the right place. U need the current_user (preferences) to set the current locale. the current_user is not available in config (initializer). In config/application.rb default locale is already set. i guess the before filter in application controller is kind of make sure we use :de, cause there is no :en (which isn't true anymore). maybe it's best to set the default locale in app_config.yml on a per foodcoop base and use it (in ApplicationController#select_language) if there is no current_user.
Thank you, that's so helpful!
In this list you could easily add customer_language
wherever you would like to have it. Here you could even set the customer language automatically whenever the customer switches it. Note that there is also geoip which makes it trivial to choose a language according to IP. You could add that as well in your priority list.
@halo thanks a lot for the ideas - I'll keep them in mind! Merged into foodcoop-adam-new, which will be put into production after ironing out some bugs.
Now that translations are landing, it would be useful that users can choose their own language. Also on signing up for a new account, it would be great if a language chooser would be visible, which would save it as preference for the new user as well. Also the site language should be configured somewhere sensible in
config/
(instead of hardcoded inapplication_controller
). Branchfoodcoop
contains some little bits already.