X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/037585db3933a2954b43bd4b30ea5e30ade00be2..e128e78408561cb0fc319f17eb39c34e579bedad:/app/controllers/amf_controller.rb diff --git a/app/controllers/amf_controller.rb b/app/controllers/amf_controller.rb index f6ae7f231..f2b592b49 100644 --- a/app/controllers/amf_controller.rb +++ b/app/controllers/amf_controller.rb @@ -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 @@ -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 ##