Author: tchemit Date: 2011-09-27 10:28:48 +0200 (Tue, 27 Sep 2011) New Revision: 3305 Url: http://chorem.org/repositories/revision/lima/3305 Log: fix i18n issues : do NOT put any hardcoded translation in static code :( Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-09-27 08:21:40 UTC (rev 3304) +++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-09-27 08:28:48 UTC (rev 3305) @@ -51,6 +51,7 @@ import java.util.Properties; import static org.nuiton.i18n.I18n._; +import static org.nuiton.i18n.I18n.n_; /** * La configuration de l'application. @@ -271,7 +272,7 @@ /** * Change the currency displaying * - * @param currency + * @param currency the new currency to set in configuration */ public void setCurrency(String currency) { setOption(Option.CURRENCY.key, currency); @@ -385,20 +386,20 @@ */ public enum Option implements OptionDef { - CONFIG_FILE(CONFIG_FILE_NAME, _("lima.config.configFileName.description"), "lima-config.properties", String.class, true, true), - DATA_DIR("lima.data.dir", _("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false), - RESOURCES_DIRECTORY("lima.resources.dir", _("lima.config.resources.dir.description"), "${lima.data.dir}/resources-${application.version}", String.class, false, false), - I18N_DIRECTORY("lima.i18n.dir", _("lima.config.i18n.dir.description"), "${lima.resources.dir}/i18n", String.class, false, false), - LOCALE("locale", _("lima.config.locale.description"), "fr_FR", Locale.class, false, false), - DECIMAL_SEPARATOR("lima.config.decimalseparator", _("lima.config.decimalseparator.description"), ",", String.class, false, false), - SCALE("scale", _("lima.config.scale.description"), "2", Integer.class, false, false), - THOUSAND_SEPARATOR("thousandSeparator", _("limma.config.thousandseparator.description"), " ", String.class, false, false), - CURRENCY("currency", _("lima.config.currency.description"), "none", Boolean.class, false, false), - FULL_SCREEN("lima.ui.fullscreen", _("lima.config.ui.fullscreen.description"), "false", Boolean.class, false, false), - LAUNCH_UI("lima.ui.launchui", _("lima.config.ui.flaunchui.description"), "true", Boolean.class, true, true), - SUPPORT_EMAIL("lima.misc.supportemail", _("lima.misc.supportemail.description"), "support@codelutin.com", String.class, false, false), - OPENEJB_REMOTEMODE("lima.openejb.remotemode", _("lima.openejb.remotemode.description"), "false", String.class, false, false), - LIMA_HOST_ADDRESS("lima.host.address", _("lima.config.host.adress"), "localhost", String.class, false, false); + CONFIG_FILE(CONFIG_FILE_NAME, n_("lima.config.configFileName.description"), "lima-config.properties", String.class, true, true), + DATA_DIR("lima.data.dir", n_("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false), + RESOURCES_DIRECTORY("lima.resources.dir", n_("lima.config.resources.dir.description"), "${lima.data.dir}/resources-${application.version}", String.class, false, false), + I18N_DIRECTORY("lima.i18n.dir", n_("lima.config.i18n.dir.description"), "${lima.resources.dir}/i18n", String.class, false, false), + LOCALE("locale", n_("lima.config.locale.description"), "fr_FR", Locale.class, false, false), + DECIMAL_SEPARATOR("lima.config.decimalseparator", n_("lima.config.decimalseparator.description"), ",", String.class, false, false), + SCALE("scale", n_("lima.config.scale.description"), "2", Integer.class, false, false), + THOUSAND_SEPARATOR("thousandSeparator", n_("limma.config.thousandseparator.description"), " ", String.class, false, false), + CURRENCY("currency", n_("lima.config.currency.description"), "none", Boolean.class, false, false), + FULL_SCREEN("lima.ui.fullscreen", n_("lima.config.ui.fullscreen.description"), "false", Boolean.class, false, false), + LAUNCH_UI("lima.ui.launchui", n_("lima.config.ui.flaunchui.description"), "true", Boolean.class, true, true), + SUPPORT_EMAIL("lima.misc.supportemail", n_("lima.misc.supportemail.description"), "support@codelutin.com", String.class, false, false), + OPENEJB_REMOTEMODE("lima.openejb.remotemode", n_("lima.openejb.remotemode.description"), "false", String.class, false, false), + LIMA_HOST_ADDRESS("lima.host.address", n_("lima.config.host.adress"), "localhost", String.class, false, false); public final String key; @@ -454,7 +455,7 @@ @Override public String getDescription() { - return description; + return _(description); } @Override @@ -471,7 +472,7 @@ /** Lima action definition. */ public enum Action { - HELP(_("lima.action.commandline.help"), MiscAction.class.getName() + "#help", "-h", "--help"); + HELP(n_("lima.action.commandline.help"), MiscAction.class.getName() + "#help", "-h", "--help"); /** Before init action step. */ public static final int BEFORE_EXIT_STEP = 0; @@ -490,6 +491,10 @@ this.action = action; this.aliases = aliases; } + + public String getDescription() { + return _(description); + } } /** Modified: trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2011-09-27 08:21:40 UTC (rev 3304) +++ trunk/lima-swing/src/main/java/org/chorem/lima/actions/MiscAction.java 2011-09-27 08:28:48 UTC (rev 3305) @@ -53,12 +53,12 @@ public void help() { System.out.println(_("lima.message.help.usage")); for (LimaConfig.Option o : LimaConfig.Option.values()) { - System.out.println("\t" + o.key + "(" + o.defaultValue + "):" + o.description); + System.out.println("\t" + o.key + "(" + o.defaultValue + "):" + o.getDescription()); } System.out.println("Actions:"); for (LimaConfig.Action a : LimaConfig.Action.values()) { - System.out.println("\t" + Arrays.toString(a.aliases) + "(" + a.action + "):" + a.description); + System.out.println("\t" + Arrays.toString(a.aliases) + "(" + a.action + "):" + a.getDescription()); } } }