source: josm/trunk/src/org/openstreetmap/josm/tools/I18n.java@ 557

Last change on this file since 557 was 298, checked in by imi, 17 years ago
  • added license description to head of each source file
File size: 1.1 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.tools;
3
4import java.text.MessageFormat;
5
6/**
7 * Internationalisation support.
8 *
9 * @author Immanuel.Scholz
10 */
11public class I18n {
12 /**
13 * Set by MainApplication. Changes here later will probably mess up everything, because
14 * many strings are already loaded.
15 */
16 public static org.xnap.commons.i18n.I18n i18n;
17
18 public static String tr(String text, Object... objects) {
19 if (i18n == null)
20 return MessageFormat.format(text, objects);
21 return i18n.tr(text, objects);
22 }
23
24 public static String tr(String text) {
25 if (i18n == null)
26 return text;
27 return i18n.tr(text);
28 }
29
30 public static String trn(String text, String pluralText, long n, Object... objects) {
31 if (i18n == null)
32 return n == 1 ? tr(text, objects) : tr(pluralText, objects);
33 return i18n.trn(text, pluralText, n, objects);
34 }
35
36 public static String trn(String text, String pluralText, long n) {
37 if (i18n == null)
38 return n == 1 ? tr(text) : tr(pluralText);
39 return i18n.trn(text, pluralText, n);
40 }
41}
Note: See TracBrowser for help on using the repository browser.