From 07211afe3e584167d17b31fc0fde198911abafaa Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 16 Jul 2009 07:37:49 +0000 Subject: [PATCH] Select the language for Potlatch indepdently of the web site. --- app/controllers/amf_controller.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index 5a8ac49c3..e29ccf0f4 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -214,6 +214,14 @@ class AmfController < ApplicationController # uses POTLATCH_PRESETS global, set up in OSM::Potlatch. def getpresets(usertoken,lang) #:doc: + user = getuser(usertoken) + + if user && !user.languages.empty? + request.user_preferred_languages = user.languages + end + + 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")) @@ -860,6 +868,9 @@ class AmfController < ApplicationController } end + def getlocales + Dir.glob("#{RAILS_ROOT}/config/potlatch/localised/*").collect { |f| File.basename(f) } + end # ==================================================================== # Alternative SQL queries for getway/whichways -- 2.43.2