Changeset 2536 in josm
- Timestamp:
- 2009-11-28T18:05:37+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/I18n.java
r2512 r2536 9 9 import java.util.MissingResourceException; 10 10 import java.util.Vector; 11 import java.util.logging.Logger; 11 12 12 13 import org.openstreetmap.josm.gui.MainApplication; 14 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 13 15 import org.xnap.commons.i18n.I18nFactory; 14 16 … … 19 21 */ 20 22 public class I18n { 23 static private final Logger logger = Logger.getLogger(I18n.class.getName()); 21 24 22 25 /* Base name for translation data. Used for detecting available translations */ … … 59 62 if (i18n == null) 60 63 return n == 1 ? tr(text, objects) : tr(pluralText, objects); 61 return filter(i18n.trn(text, pluralText, n, objects));64 return filter(i18n.trn(text, pluralText, n, objects)); 62 65 } 63 66 … … 65 68 if (i18n == null) 66 69 return n == 1 ? tr(text) : tr(pluralText); 67 return filter(i18n.trn(text, pluralText, n));70 return filter(i18n.trn(text, pluralText, n)); 68 71 } 69 72 … … 71 74 if (i18n == null) 72 75 return n == 1 ? tr(text, objects) : tr(pluralText, objects); 73 return i18n.trnc(ctx, text, pluralText, n, objects);76 return i18n.trnc(ctx, text, pluralText, n, objects); 74 77 } 75 78 … … 77 80 if (i18n == null) 78 81 return n == 1 ? tr(text) : tr(pluralText); 79 return i18n.trnc(ctx, text, pluralText, n);82 return i18n.trnc(ctx, text, pluralText, n); 80 83 } 81 84 … … 92 95 * @return an array of locale objects. 93 96 */ 94 public static final Locale[] getAvailableTranslations() { 97 public static final Locale[] getAvailableTranslations(ProgressMonitor monitor) { 98 monitor.indeterminateSubTask(tr("Loading available locales...")); 95 99 Vector<Locale> v = new Vector<Locale>(); 96 100 LinkedList<String>str = new LinkedList<String>(); 97 101 Locale[] l = Locale.getAvailableLocales(); 102 monitor.subTask(tr("Checking locales...")); 103 monitor.setTicksCount(l.length); 98 104 for (int i = 0; i < l.length; i++) { 105 monitor.setCustomText(tr("Checking translation for locale ''{0}''", l[i].getDisplayName())); 99 106 String loc = l[i].toString(); 100 107 String cn = TR_BASE + loc; … … 105 112 } catch (ClassNotFoundException e) { 106 113 } 114 monitor.worked(1); 107 115 } 108 116 /* hmm, don't know why this is necessary */ 109 117 try { 110 if(!str.contains("nb")) 111 v.add(new Locale("nb")); 118 if(!str.contains("nb")) { 119 v.add(new Locale("nb")); 120 } 112 121 } catch (Exception e) {} 113 122 try { 114 if(!str.contains("gl")) 115 v.add(new Locale("gl")); 123 if(!str.contains("gl")) { 124 v.add(new Locale("gl")); 125 } 116 126 } catch (Exception e) {} 117 127 l = new Locale[v.size()]; … … 145 155 Locale l; 146 156 Locale d = Locale.getDefault(); 147 if (localeName.equals("he")) localeName = "iw_IL"; 157 if (localeName.equals("he")) { 158 localeName = "iw_IL"; 159 } 148 160 int i = localeName.indexOf('_'); 149 161 if (i > 0) { … … 158 170 if (!l.getLanguage().equals("en")) { 159 171 System.out.println(tr("Unable to find translation for the locale {0}. Reverting to {1}.", 160 l.getDisplayName(), d.getDisplayName()));172 l.getDisplayName(), d.getDisplayName())); 161 173 Locale.setDefault(d); 162 174 } else {
Note:
See TracChangeset
for help on using the changeset viewer.