Don't use the (unset) value of I18n.locale to try and select a language

as the one we want is in lang so just use that. Fixes #2071.
This commit is contained in:
Tom Hughes 2009-07-16 20:26:18 +00:00
parent b19a12140e
commit bf0e4291a2

View file

@ -222,10 +222,6 @@ class AmfController < ApplicationController
lang = request.compatible_language_from(getlocales) lang = request.compatible_language_from(getlocales)
begin
# first, try the user setting
localised = YAML::load(File.open("#{RAILS_ROOT}/config/potlatch/localised/#{I18n.locale}/localised.yaml"))
rescue
begin begin
# if not, try the browser language # if not, try the browser language
localised = YAML::load(File.open("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/localised.yaml")) localised = YAML::load(File.open("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/localised.yaml"))
@ -233,17 +229,12 @@ class AmfController < ApplicationController
# fall back to hardcoded English text # fall back to hardcoded English text
localised = "" localised = ""
end end
end
begin
help = File.read("#{RAILS_ROOT}/config/potlatch/localised/#{I18n.locale}/help.html")
rescue
begin begin
help = File.read("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/help.html") help = File.read("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/help.html")
rescue rescue
help = File.read("#{RAILS_ROOT}/config/potlatch/localised/en/help.html") help = File.read("#{RAILS_ROOT}/config/potlatch/localised/en/help.html")
end end
end
return POTLATCH_PRESETS+[localised,help] return POTLATCH_PRESETS+[localised,help]
end end