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); |
184 |
put(DEFAULT_KEY, defaultTranslation); |
put(DEFAULT_KEY, defaultTranslation); |
185 |
} else |
} else |
186 |
for (String code : languages) { |
for (String code : languages) { |
187 |
if (code.equals(getActiveLang())) { |
// if (code.equals(getActiveLang())) { |
188 |
put(code, defaultTranslation); |
put(code, defaultTranslation); |
189 |
} |
// } |
190 |
} |
} |
191 |
} |
} |
192 |
|
|
341 |
*/ |
*/ |
342 |
public void addTranslationChangeListener(ActionListener actionListener) { |
public void addTranslationChangeListener(ActionListener actionListener) { |
343 |
if (actionListeners.add(actionListener)) { |
if (actionListeners.add(actionListener)) { |
344 |
LOGGER |
// LOGGER |
345 |
.debug("registering a new translationChangeActionListener in the WeakHashSet"); |
// .debug("registering a new translationChangeActionListener in the WeakHashSet"); |
346 |
} |
} |
347 |
} |
} |
348 |
|
|