add configuration for default language

This commit is contained in:
wvengen 2014-02-21 14:28:27 +01:00
parent 3f032e5dd9
commit 03585e272f
2 changed files with 11 additions and 3 deletions

View File

@ -34,6 +34,13 @@ default: &defaults
# documentation URL for the apples&pears work system
applepear_url: https://github.com/foodcoops/foodsoft/wiki/%C3%84pfel-u.-Birnen
# Default language
#default_locale: en
# By default, foodsoft takes the language from the webbrowser/operating system.
# In case you really want foodsoft in a certain language by default, set this to true.
# When members are logged in, the language from their profile settings is still used.
#ignore_browser_locale: false
# price markup in percent
price_markup: 2.0

View File

@ -25,13 +25,14 @@ module Foodsoft
end
def default_language
::I18n.default_locale
FoodsoftConfig[:default_locale] or ::I18n.default_locale
end
protected
def select_language_according_to_priority
language = explicitly_requested_language || session_language || user_settings_language || browser_language
language = explicitly_requested_language || session_language || user_settings_language
language ||= browser_language unless FoodsoftConfig[:ignore_browser_locale]
language.to_sym unless language.blank?
end
@ -52,4 +53,4 @@ module Foodsoft
end
end
end
end