chore: use variable instead or hardcoding strings
parent
480f2e79ef
commit
d2a2f80135
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue