Revision 222
org.gvsig.fortunecookies/trunk/basic-with-user-interface/org.gvsig.fortunecookies/org.gvsig.fortunecookies.swing/org.gvsig.fortunecookies.swing.impl/src/main/java/org/gvsig/fortunecookies/swing/impl/DefaultFortuneCookieSwingManager.java | ||
---|---|---|
41 | 41 |
FortuneCookieSwingManager { |
42 | 42 |
|
43 | 43 |
private FortuneCookieManager manager = null; |
44 |
private I18nManager i18nManager = null; |
|
45 | 44 |
|
46 | 45 |
public DefaultFortuneCookieSwingManager() { |
47 | 46 |
this.manager = FortuneCookieLocator.getManager(); |
... | ... | |
58 | 57 |
return this.manager; |
59 | 58 |
} |
60 | 59 |
|
61 |
public String translate(String key) { |
|
62 |
if( this.i18nManager == null ) { |
|
63 |
this.i18nManager = ToolsLocator.getI18nManager(); |
|
64 |
} |
|
65 |
return this.i18nManager.getTranslation(key); |
|
66 |
} |
|
67 | 60 |
} |
org.gvsig.fortunecookies/trunk/basic-with-user-interface/org.gvsig.fortunecookies/org.gvsig.fortunecookies.swing/org.gvsig.fortunecookies.swing.impl/src/main/java/org/gvsig/fortunecookies/swing/impl/DefaultJFortuneCookiePanel.java | ||
---|---|---|
11 | 11 |
import org.gvsig.fortunecookies.FortuneCookie; |
12 | 12 |
import org.gvsig.fortunecookies.FortuneCookieMessageException; |
13 | 13 |
import org.gvsig.fortunecookies.swing.JFortuneCookiePanel; |
14 |
import org.gvsig.tools.ToolsLocator; |
|
15 |
import org.gvsig.tools.i18n.I18nManager; |
|
14 | 16 |
import org.slf4j.Logger; |
15 | 17 |
import org.slf4j.LoggerFactory; |
16 | 18 |
|
... | ... | |
43 | 45 |
} |
44 | 46 |
|
45 | 47 |
private void translateComponents() { |
46 |
this.closeButton.setText(manager.translate("_Close")); |
|
47 |
this.headerLabel.setText(manager.translate("_Fortune_cookie_message")); |
|
48 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
49 |
this.closeButton.setText(i18nManager.getTranslation("_Close")); |
|
50 |
this.headerLabel.setText(i18nManager.getTranslation("_Fortune_cookie_message")); |
|
48 | 51 |
} |
49 | 52 |
|
50 | 53 |
private void initComponents() { |
... | ... | |
63 | 66 |
this.dateLabel.setText(this.cookie.getDate().toString()); |
64 | 67 |
} catch (FortuneCookieMessageException e) { |
65 | 68 |
logger.warn("Can't get message.", e); |
69 |
I18nManager i18nManager = ToolsLocator.getI18nManager(); |
|
66 | 70 |
JOptionPane.showMessageDialog( |
67 | 71 |
null, |
68 |
manager.translate("_Cant_get_fortune_cookie_message"),
|
|
69 |
manager.translate("_Fortune_cookie"),
|
|
72 |
i18nManager.getTranslation("_Cant_get_fortune_cookie_message"),
|
|
73 |
i18nManager.getTranslation("_Fortune_cookie"),
|
|
70 | 74 |
JOptionPane.WARNING_MESSAGE |
71 | 75 |
); |
72 | 76 |
} |
Also available in: Unified diff