foodcoop-adam / foodsoft

DEPRECATED, being merged in upstream. Web-based software for foodcoops - as used in NL.
http://foodcoop-adam.github.io/
Other
10 stars 3 forks source link

add language preference to user profile #23

Closed wvengen closed 11 years ago

wvengen commented 11 years ago

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 in application_controller). Branch foodcoop contains some little bits already.

fsmanuel commented 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.

wvengen commented 11 years ago

Thank you, that's so helpful!

halo commented 11 years ago

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.

wvengen commented 11 years ago

@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.