Changeset 2174 in josm


Ignore:
Timestamp:
2009-09-20T22:17:04+02:00 (15 years ago)
Author:
stoecker
Message:

added context handling for translated strings

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/coor/LatLon.java

    r2017 r2174  
    5353        switch(d) {
    5454        case DECIMAL_DEGREES: return cDdFormatter.format(y);
    55         case DEGREES_MINUTES_SECONDS: return dms(y) + ((y < 0) ? tr("S") : tr("N"));
     55        case DEGREES_MINUTES_SECONDS: return dms(y) + ((y < 0) ?
     56            /* short symbol for South */ tr("S") :
     57            /* short symbol for North */ tr("N"));
    5658        default: return "ERR";
    5759        }
     
    6567        switch(d) {
    6668        case DECIMAL_DEGREES: return cDdFormatter.format(x);
    67         case DEGREES_MINUTES_SECONDS: return dms(x) + ((x < 0) ? tr("W") : tr("E"));
     69        case DEGREES_MINUTES_SECONDS: return dms(x) + ((x < 0) ?
     70            /* short symbol for West */ tr("W") :
     71            /* short symbol for East */ tr("E"));
    6872        default: return "ERR";
    6973        }
  • trunk/src/org/openstreetmap/josm/data/osm/Filters.java

    r2145 r2174  
    139139
    140140   public String getColumnName(int column){
    141       String[] names = { tr("E"), tr("H"), tr("Text"), tr("C"), tr("I"), tr("M") };
     141      String[] names = { /* translators notes must be in front */
     142          /* column header: enable filter */             tr("~filter:E"),
     143          /* column header: hide filter */               tr("H"),
     144          /* column header: filter text */               tr("Text"),
     145          /* column header: apply filter for children */ tr("C"),
     146          /* column header: inverted filter */           tr("I"),
     147          /* column header: filter mode */               tr("M")
     148      };
    142149      return names[column];
    143150   }
     
    195202         case 4: return f.inverted;
    196203         case 5:
    197                  switch(f.mode){
    198                     case replace: return tr("R");
    199                     case add: return tr("A");
    200                     case remove: return tr("D");
    201                     case in_selection: return tr("F");
     204                 switch(f.mode){ /* translators notes must be in front */
     205                    case replace:      /* filter mode: replace */      return tr("R");
     206                    case add:          /* filter mode: add */          return tr("A");
     207                    case remove:       /* filter mode: remove */       return tr("D");
     208                    case in_selection: /* filter mode: in selection */ return tr("F");
    202209                 }
    203210      }
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r2017 r2174  
    3131    public static final String tr(String text, Object... objects) {
    3232        if (i18n == null)
    33             return MessageFormat.format(text, objects);
    34         return i18n.tr(text, objects);
     33            return filter(MessageFormat.format(text, objects));
     34        return filter(i18n.tr(text, objects));
    3535    }
    3636
    3737    public static final String tr(String text) {
    3838        if (i18n == null)
    39             return text;
    40         return i18n.tr(text);
     39            return filter(text);
     40        return filter(i18n.tr(text));
    4141    }
    4242
     
    4747    public static final String trn(String text, String pluralText, long n, Object... objects) {
    4848        if (i18n == null)
    49             return n == 1 ? tr(text, objects) : tr(pluralText, objects);
    50         return i18n.trn(text, pluralText, n, objects);
     49            return filter(n == 1 ? tr(text, objects) : tr(pluralText, objects));
     50        return filter(i18n.trn(text, pluralText, n, objects));
    5151    }
    5252
    5353    public static final String trn(String text, String pluralText, long n) {
    5454        if (i18n == null)
    55             return n == 1 ? tr(text) : tr(pluralText);
    56         return i18n.trn(text, pluralText, n);
     55            return filter(n == 1 ? tr(text) : tr(pluralText));
     56        return filter(i18n.trn(text, pluralText, n));
     57    }
     58
     59    public static final String filter(String text)
     60    {
     61        int i;
     62        if(text.startsWith("~") && (i = text.indexOf(":")) >= 0)
     63            return text.substring(i+1);
     64        return text;
    5765    }
    5866
Note: See TracChangeset for help on using the changeset viewer.