From d2a2f8013532649baa64bc361db7dca118780904 Mon Sep 17 00:00:00 2001 From: Davide Polonio Date: Mon, 3 Apr 2023 09:37:12 +0200 Subject: [PATCH] chore: use variable instead or hardcoding strings --- .../polpetta/mezzotre/i18n/LocalizedMessageFactory.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/github/polpetta/mezzotre/i18n/LocalizedMessageFactory.java b/src/main/java/com/github/polpetta/mezzotre/i18n/LocalizedMessageFactory.java index 97a0c8b..36db9e4 100644 --- a/src/main/java/com/github/polpetta/mezzotre/i18n/LocalizedMessageFactory.java +++ b/src/main/java/com/github/polpetta/mezzotre/i18n/LocalizedMessageFactory.java @@ -21,6 +21,8 @@ import org.apache.velocity.tools.config.ToolboxConfiguration; */ public class LocalizedMessageFactory { + private static final String MESSAGE_PATH = "i18n/message"; + private final VelocityEngine velocityEngine; @Inject @@ -47,7 +49,7 @@ public class LocalizedMessageFactory { toolConfiguration.setClassname(LocalizedTool.class.getName()); toolConfiguration.setProperty("file.resource.loader.class", JarResourceLoader.class.getName()); toolConfiguration.setProperty(ToolContext.LOCALE_KEY, locale); - toolConfiguration.setProperty(LocalizedTool.BUNDLES_KEY, "i18n/message"); + toolConfiguration.setProperty(LocalizedTool.BUNDLES_KEY, MESSAGE_PATH); toolboxConfiguration.addTool(toolConfiguration); factoryConfiguration.addToolbox(toolboxConfiguration); toolManager.configure(factoryConfiguration); @@ -61,6 +63,6 @@ public class LocalizedMessageFactory { * @return a {@link ResourceBundle} with the provided locale */ public ResourceBundle createResourceBundle(Locale locale) { - return ResourceBundle.getBundle("i18n/message", locale); + return ResourceBundle.getBundle(MESSAGE_PATH, locale); } }