From: Richard Fairhurst Date: Thu, 16 Jul 2009 01:20:47 +0000 (+0000) Subject: Potlatch 1.1a X-Git-Tag: live~6818 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/6599fe05863769affec40b65f0447a5524f67290?hp=25d0017b18773458529275d2f60f2599ee03a633;ds=inline Potlatch 1.1a --- diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index c7fa5dd80..5a8ac49c3 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -76,7 +76,7 @@ class AmfController < ApplicationController logger.info("Executing AMF #{message}(#{args.join(',')}):#{index}") case message - when 'getpresets'; results[index]=AMF.putdata(index,getpresets(I18n.locale)) + when 'getpresets'; results[index]=AMF.putdata(index,getpresets(*args)) when 'whichways'; results[index]=AMF.putdata(index,whichways(*args)) when 'whichways_deleted'; results[index]=AMF.putdata(index,whichways_deleted(*args)) when 'getway'; results[index]=AMF.putdata(index,getway(args[0].to_i)) @@ -213,19 +213,28 @@ class AmfController < ApplicationController # Return presets (default tags, localisation etc.): # uses POTLATCH_PRESETS global, set up in OSM::Potlatch. - def getpresets(lang) #:doc: + def getpresets(usertoken,lang) #:doc: begin - logger.info("Loading Potlatch/#{lang} localisation") - localised = YAML::load(File.open("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/localised.yaml")) + # first, try the user setting + localised = YAML::load(File.open("#{RAILS_ROOT}/config/potlatch/localised/#{I18n.locale}/localised.yaml")) rescue - logger.info("Loading Potlatch/#{lang} localisation failed, using English defaults") - localised = "" # guess we'll just have to use the hardcoded English text instead + 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 end begin - help = File.read("#{RAILS_ROOT}/config/potlatch/localised/#{lang}/help.html") + help = File.read("#{RAILS_ROOT}/config/potlatch/localised/#{I18n.locale}/help.html") rescue - help = File.read("#{RAILS_ROOT}/config/potlatch/localised/en/help.html") + 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 end return POTLATCH_PRESETS+[localised,help] end diff --git a/public/potlatch/potlatch.swf b/public/potlatch/potlatch.swf index 8ee7e840a..8b109ec6a 100755 Binary files a/public/potlatch/potlatch.swf and b/public/potlatch/potlatch.swf differ