Ignore:
Timestamp:
2024-04-19T11:48:22+02:00 (2 years ago)
Author:
stoecker
Message:

support language keys not following the naming of languages in JOSM, allow more than one language specific code, see #23627

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/LabelCompositionStrategy.java

    r17466 r19045  
    145145         * The list of default name tags from which a label candidate is derived.
    146146         */
    147         private static final String[] DEFAULT_NAME_TAGS = {
    148             "name:" + LanguageInfo.getJOSMLocaleCode(),
    149             "name",
    150             "int_name",
    151             "distance",
    152             "railway:position",
    153             "ref",
    154             "operator",
    155             "brand",
    156             "addr:unit",
    157             "addr:flats",
    158             "addr:housenumber"
    159         };
     147        private static final String[] DEFAULT_NAME_TAGS = getDefaultNameTags();
    160148
    161149        /**
     
    175163            Config.getPref().addPreferenceChangeListener(this);
    176164            initNameTagsFromPreferences();
     165        }
     166
     167        /* Is joining an array really that complicated in Java? */
     168        private static String[] getDefaultNameTags() {
     169            ArrayList<String> tags = new ArrayList<String>(Arrays.asList(LanguageInfo.getOSMLocaleCodes("name:")));
     170            tags.addAll(Arrays.asList(new String[]{
     171                "name",
     172                "int_name",
     173                "distance",
     174                "railway:position",
     175                "ref",
     176                "operator",
     177                "brand",
     178                "addr:unit",
     179                "addr:flats",
     180                "addr:housenumber"
     181            }));
     182            return tags.toArray(String[]::new);
    177183        }
    178184
Note: See TracChangeset for help on using the changeset viewer.