Improve name selection with the query tool
Pass the full expanded list of preferred languages to the client and use that when looking for the best name for an object. Fixes #4310
This commit is contained in:
parent
1ce5d7dec1
commit
c94de1e1a3
3 changed files with 4 additions and 2 deletions
|
@ -124,6 +124,7 @@ $(document).ready(function () {
|
|||
I18n.fallbacks = true;
|
||||
|
||||
OSM.preferred_editor = application_data.preferredEditor;
|
||||
OSM.preferred_languages = application_data.preferredLanguages;
|
||||
|
||||
if (application_data.user) {
|
||||
OSM.user = application_data.user;
|
||||
|
|
|
@ -125,7 +125,7 @@ OSM.Query = function (map) {
|
|||
|
||||
function featureName(feature) {
|
||||
var tags = feature.tags,
|
||||
locales = I18n.locales.get();
|
||||
locales = OSM.preferred_languages;
|
||||
|
||||
for (var i = 0; i < locales.length; i++) {
|
||||
if (tags["name:" + locales[i]]) {
|
||||
|
|
|
@ -48,7 +48,8 @@ module ApplicationHelper
|
|||
def application_data
|
||||
data = {
|
||||
:locale => I18n.locale,
|
||||
:preferred_editor => preferred_editor
|
||||
:preferred_editor => preferred_editor,
|
||||
:preferred_languages => preferred_languages.expand.map(&:to_s)
|
||||
}
|
||||
|
||||
if current_user
|
||||
|
|
Loading…
Add table
Reference in a new issue