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

Last change on this file since 1023 was 758, checked in by stoecker, 16 years ago

unified translation a bit

  • Property svn:eol-style set to native
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 final 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 final String tr(String text) {
25 if (i18n == null)
26 return text;
27 return i18n.tr(text);
28 }
29
30 public static final String marktr(String text) {
31 return text;
32 }
33
34 public static final String trn(String text, String pluralText, long n, Object... objects) {
35 if (i18n == null)
36 return n == 1 ? tr(text, objects) : tr(pluralText, objects);
37 return i18n.trn(text, pluralText, n, objects);
38 }
39
40 public static final String trn(String text, String pluralText, long n) {
41 if (i18n == null)
42 return n == 1 ? tr(text) : tr(pluralText);
43 return i18n.trn(text, pluralText, n);
44 }
45}
Note: See TracBrowser for help on using the repository browser.