Changeset 5173 in josm


Ignore:
Timestamp:
Apr 8, 2012 1:27:30 AM (14 months ago)
Author:
simon04
Message:

see #7552 - presets: handle translation correctly for <combo>, propagate values_context to <list_entry> (or set value_context there)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r5172 r5173  
    267267    public static class PresetListEntry { 
    268268        public String value; 
     269        public String value_context; 
    269270        public String display_value; 
    270271        public String short_description; 
     
    305306        public String getDisplayValue(boolean translated) { 
    306307            return translated 
    307                     ? Utils.firstNonNull(locale_display_value, tr(display_value), tr(value)) 
     308                    ? Utils.firstNonNull(locale_display_value, tr(display_value), trc(value_context, value)) 
    308309                    : Utils.firstNonNull(display_value, value); 
    309310        } 
     
    581582                int i = 0; 
    582583                for (PresetListEntry e : lhm.values()) { 
     584                    if (e.value_context == null) { 
     585                        e.value_context = values_context; 
     586                    } 
    583587                    display_array[i++] = e.getDisplayValue(true); 
    584588                } 
     
    586590 
    587591            if (locale_text == null) { 
    588                 if (text_context != null) { 
    589                     locale_text = trc(text_context, fixPresetString(text)); 
    590                 } else { 
    591                     locale_text = tr(fixPresetString(text)); 
    592                 } 
     592                locale_text = trc(text_context, fixPresetString(text)); 
    593593            } 
    594594            p.add(new JLabel(locale_text + ":"), GBC.std().insets(0, 0, 10, 0)); 
     
    625625            } 
    626626            for (int i = 0; i < value_array.length; i++) { 
    627                 PresetListEntry e = new PresetListEntry(value_array[i]); 
    628                 e.display_value = (locale_display_values == null) 
    629                         ? (values_context == null ? tr(fixPresetString(display_array[i])) 
    630                                 : trc(values_context, fixPresetString(display_array[i]))) : display_array[i]; 
    631                         if (short_descriptions_array != null) { 
    632                             e.short_description = locale_short_descriptions == null ? tr(fixPresetString(short_descriptions_array[i])) 
    633                                     : fixPresetString(short_descriptions_array[i]); 
    634                         } 
    635                         lhm.put(value_array[i], e); 
     627                final PresetListEntry e = new PresetListEntry(value_array[i]); 
     628                e.locale_display_value = locale_display_values != null 
     629                        ? display_array[i] 
     630                        : trc(values_context, fixPresetString(display_array[i])); 
     631                if (short_descriptions_array != null) { 
     632                    e.locale_short_description = locale_short_descriptions != null 
     633                            ? short_descriptions_array[i] 
     634                            : tr(fixPresetString(short_descriptions_array[i])); 
     635                } 
     636                lhm.put(value_array[i], e); 
    636637            } 
    637638 
Note: See TracChangeset for help on using the changeset viewer.