X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/23f568cf3a0f4a5f102952ebe68d6d2636e82b1b..e128e78408561cb0fc319f17eb39c34e579bedad:/app/controllers/amf_controller.rb diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index fb50b6aad..f2b592b49 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -98,7 +98,7 @@ class AmfController < ApplicationController result = startchangeset(*args) end - err = true if result[0] == -3 # If a conflict is detected, don't execute any more writes + err = true if result[0] == -3 # If a conflict is detected, don't execute any more writes end result @@ -190,11 +190,13 @@ class AmfController < ApplicationController user = getuser(usertoken) if user && !user.languages.empty? - http_accept_language.user_preferred_languages = user.languages + langs = Locale.list(user.languages) + else + langs = Locale.list(http_accept_language.user_preferred_languages) end - lang = http_accept_language.compatible_language_from(getlocales) - (real_lang, localised) = getlocalized(lang) + lang = getlocales.preferred(langs) + (real_lang, localised) = getlocalized(lang.to_s) # Tell Potlatch what language it's using localised["__potlatch_locale"] = real_lang @@ -527,7 +529,7 @@ class AmfController < ApplicationController # 3. version. def putrelation(renumberednodes, renumberedways, usertoken, changeset_id, version, relid, tags, members, visible) #:doc: - amf_handle_error("'putrelation' #{relid}", "relation", relid) do + amf_handle_error("'putrelation' #{relid}", "relation", relid) do user = getuser(usertoken) return -1, "You are not logged in, so the relation could not be saved." unless user @@ -645,7 +647,7 @@ class AmfController < ApplicationController return -2, "Server error - node with id 0 found in way #{originalway}." if id == 0 return -2, "Server error - node with latitude -90 found in way #{originalway}." if lat == 90 - id = renumberednodes[id] if renumberednodes[id] + id = renumberednodes[id] if renumberednodes[id] node = Node.new node.changeset_id = changeset_id @@ -874,7 +876,7 @@ class AmfController < ApplicationController end def getlocales - Dir.glob("#{Rails.root}/config/potlatch/locales/*").collect { |f| File.basename(f, ".yml") } + @locales ||= Locale.list(Dir.glob("#{Rails.root}/config/potlatch/locales/*").collect { |f| File.basename(f, ".yml") }) end ##