58 |
/** |
/** |
59 |
* Set up the {@link Translation}-system to use language. If a change is |
* Set up the {@link Translation}-system to use language. If a change is |
60 |
* performed, events are fired to listeners. Nothing is done if the new |
* performed, events are fired to listeners. Nothing is done if the new |
61 |
* language equals the old language. |
* language equals the old language. The system's default locale is changed. |
62 |
* |
* |
63 |
* @param newLang |
* @param newLang |
64 |
* The ISO Code of the new active language |
* The ISO Code of the new active language |
65 |
*/ |
*/ |
66 |
public static void setActiveLang(String newLang) { |
public static void setActiveLang(String newLang) { |
67 |
|
setActiveLang(newLang, true); |
68 |
|
} |
69 |
|
|
70 |
|
/** |
71 |
|
* Set up the {@link Translation}-system to use language. If a change is |
72 |
|
* performed, events are fired to listeners. Nothing is done if the new |
73 |
|
* language equals the old language. |
74 |
|
* |
75 |
|
* @param newLang |
76 |
|
* The ISO Code of the new active language |
77 |
|
* |
78 |
|
* @param setDefaultLocale |
79 |
|
* Shall the system's default locale be changed? |
80 |
|
*/ |
81 |
|
public static void setActiveLang(String newLang, boolean setDefaultLocale) { |
82 |
if (getActiveLang().equals(newLang)) { |
if (getActiveLang().equals(newLang)) { |
83 |
return; |
return; |
84 |
} |
} |
89 |
} |
} |
90 |
|
|
91 |
Locale newLocale = new Locale(newLang); |
Locale newLocale = new Locale(newLang); |
92 |
Locale.setDefault(newLocale); |
if (setDefaultLocale) |
93 |
|
Locale.setDefault(newLocale); |
94 |
|
|
95 |
/** |
/** |
96 |
* Setting default locale for Swing JComponents to work around bug |
* Setting default locale for Swing JComponents to work around bug |
107 |
|
|
108 |
/** |
/** |
109 |
* Initializes a new {@link Translation} with a default translation if a |
* Initializes a new {@link Translation} with a default translation if a |
110 |
* simple text is passed. If a "oneLine" text is parsed, it is |
* simple text is passed. If a "oneLine" text is parsed, it is interpreted. |
111 |
* interpreted. Other translations may be added later - this is a HashMap<br/> |
* Other translations may be added later - this is a HashMap<br/> |
112 |
* |
* |
113 |
* @param defaultTranslation |
* @param defaultTranslation |
114 |
* |
* |
229 |
return s; |
return s; |
230 |
} |
} |
231 |
} |
} |
232 |
log.warn("No translation found!"); |
// log.warn("No translation found!"); |
233 |
return NO_TRANSLATION; |
return NO_TRANSLATION; |
234 |
} |
} |
235 |
|
|