chore: use variable instead or hardcoding strings
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is failing Details

pull/2/head
Davide Polonio 2023-04-03 09:37:12 +02:00
parent 480f2e79ef
commit d2a2f80135
1 changed files with 4 additions and 2 deletions

View File

@ -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);
}
}