25 |
* |
* |
26 |
* Contributors: |
* Contributors: |
27 |
* Martin O. J. Schmitz - initial API and implementation |
* Martin O. J. Schmitz - initial API and implementation |
28 |
* Stefan A. Krüger - additional utility classes |
* Stefan A. Tzeggai - additional utility classes |
29 |
******************************************************************************/ |
******************************************************************************/ |
30 |
package skrueger.i8n; |
package skrueger.i8n; |
31 |
|
|
33 |
import java.awt.event.ActionListener; |
import java.awt.event.ActionListener; |
34 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeEvent; |
35 |
import java.beans.PropertyChangeListener; |
import java.beans.PropertyChangeListener; |
36 |
|
import java.io.Serializable; |
37 |
import java.util.ArrayList; |
import java.util.ArrayList; |
38 |
import java.util.HashMap; |
import java.util.HashMap; |
39 |
import java.util.Iterator; |
import java.util.Iterator; |
59 |
*/ |
*/ |
60 |
|
|
61 |
public class Translation extends HashMap<String, String> implements |
public class Translation extends HashMap<String, String> implements |
62 |
Copyable<Translation> { |
Copyable<Translation>, Serializable { |
63 |
|
|
64 |
|
private static final long serialVersionUID = -347702744122305245L; |
65 |
|
|
66 |
public static final String LOCALECHANGE_PROPERTY = "localechange"; |
public static final String LOCALECHANGE_PROPERTY = "localechange"; |
67 |
public static final String NO_TRANSLATION = "NO TRANSLATION"; |
public static final String NO_TRANSLATION = "NO TRANSLATION"; |
68 |
public static final String DEFAULT_KEY = "default"; |
public static final String DEFAULT_KEY = "default"; |
81 |
Locale locale = Locale.getDefault(); |
Locale locale = Locale.getDefault(); |
82 |
setActiveLang(locale.getLanguage()); |
setActiveLang(locale.getLanguage()); |
83 |
} |
} |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
private WeakHashSet<ActionListener> actionListeners = new WeakHashSet<ActionListener>( |
private WeakHashSet<ActionListener> actionListeners = new WeakHashSet<ActionListener>( |
88 |
ActionListener.class); |
ActionListener.class); |
205 |
* <li>If format can't be recognized, the {@link String} is interpreted as |
* <li>If format can't be recognized, the {@link String} is interpreted as |
206 |
* the translation in the <code>{@value #DEFAULT_KEY}</code> language |
* the translation in the <code>{@value #DEFAULT_KEY}</code> language |
207 |
* |
* |
208 |
* @author Stefan Alfons Krüger |
* @author Stefan Alfons Tzeggai |
209 |
*/ |
*/ |
210 |
public void fromOneLine(final String oneLineCoded) { |
public void fromOneLine(final String oneLineCoded) { |
211 |
|
|
246 |
/** |
/** |
247 |
* Exports the Translations to a String of the Format: "de{Baum}en{tree}" |
* Exports the Translations to a String of the Format: "de{Baum}en{tree}" |
248 |
* |
* |
249 |
* @author Stefan Alfons Krüger |
* @author Stefan Alfons Tzeggai |
250 |
*/ |
*/ |
251 |
public String toOneLine() { |
public String toOneLine() { |
252 |
return I8NUtil.toOneLine(this); |
return I8NUtil.toOneLine(this); |