Changeset 112 in josm
- Timestamp:
- 2006-07-17T00:18:11+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/tools/I18n.java
r111 r112 1 1 package org.openstreetmap.josm.tools; 2 3 import java.text.MessageFormat; 4 import java.util.Locale; 5 import java.util.MissingResourceException; 2 6 3 7 import org.openstreetmap.josm.Main; … … 10 14 */ 11 15 public class I18n { 12 private static org.xnap.commons.i18n.I18n i18n = I18nFactory.getI18n(Main.class); 16 private static org.xnap.commons.i18n.I18n i18n; 17 18 static { 19 try { 20 i18n = I18nFactory.getI18n(Main.class); 21 } catch (MissingResourceException e) { 22 System.out.println("Locale '"+Locale.getDefault().getLanguage()+"' not found. Using default."); 23 } 24 } 13 25 14 26 public static String tr(String text, Object... objects) { 27 if (i18n == null) 28 return MessageFormat.format(text, objects); 15 29 return i18n.tr(text, objects); 16 30 } 17 31 18 32 public static String tr(String text) { 33 if (i18n == null) 34 return text; 19 35 return i18n.tr(text); 20 36 } 21 37 22 38 public static String trn(String text, String pluralText, long n, Object... objects) { 39 if (i18n == null) 40 return n == 1 ? tr(text, objects) : tr(pluralText, objects); 23 41 return i18n.trn(text, pluralText, n, objects); 24 42 } 25 43 26 44 public static String trn(String text, String pluralText, long n) { 45 if (i18n == null) 46 return n == 1 ? tr(text) : tr(pluralText); 27 47 return i18n.trn(text, pluralText, n); 28 48 }
Note:
See TracChangeset
for help on using the changeset viewer.