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