From: Tom Hughes Date: Thu, 16 Jul 2009 20:26:18 +0000 (+0000) Subject: Don't use the (unset) value of I18n.locale to try and select a language X-Git-Tag: live~6795 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/bf0e4291a2f23a1c999cb4555234f70c2489a15f?hp=b19a12140eb3d809be4781594798ff1d01c4ba3d 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. --- diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index e29ccf0f4..2aee84d0c 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -223,26 +223,17 @@ class AmfController < ApplicationController 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")) + # if not, try the browser language + localised = YAML::load(File.open("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/localised.yaml")) rescue - begin - # if not, try the browser language - localised = YAML::load(File.open("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/localised.yaml")) - rescue - # fall back to hardcoded English text - localised = "" - end + # fall back to hardcoded English text + localised = "" end begin - help = File.read("#{RAILS_ROOT}/config/potlatch/localised/#{I18n.locale}/help.html") + help = File.read("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/help.html") rescue - begin - help = File.read("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/help.html") - rescue - help = File.read("#{RAILS_ROOT}/config/potlatch/localised/en/help.html") - end + help = File.read("#{RAILS_ROOT}/config/potlatch/localised/en/help.html") end return POTLATCH_PRESETS+[localised,help] end