diff --git a/src/main/java/com/github/polpetta/mezzotre/i18n/TemplateContentGenerator.java b/src/main/java/com/github/polpetta/mezzotre/i18n/TemplateContentGenerator.java index 794e2ec..33438eb 100644 --- a/src/main/java/com/github/polpetta/mezzotre/i18n/TemplateContentGenerator.java +++ b/src/main/java/com/github/polpetta/mezzotre/i18n/TemplateContentGenerator.java @@ -8,7 +8,7 @@ import org.apache.velocity.VelocityContext; import org.apache.velocity.tools.ToolManager; import org.apache.velocity.util.StringBuilderWriter; -// FIXME doc, tests +// FIXME tests /** * This class aims to generate localized messages or strings either merging Velocity templates or @@ -61,10 +61,27 @@ public class TemplateContentGenerator { return content.toString(); } + /** + * Get a localized {@link String} + * + * @param locale a provided {@link Locale} + * @param key the key that will be retrieved from the localized messages + * @return a localized {@link String} + * @see #getString(String, String) + */ public String getString(Locale locale, String key) { return localizedMessageFactory.createResourceBundle(locale).getString(key); } + /** + * Get a localized {@link String} + * + * @param localeAsString a provided {@link Locale} as a {@link String}. Will be converted using + * {@link Locale#forLanguageTag(String)} + * @param key the key that will be retrieved from the localized messages + * @return a localized {@link String} + * @see #getString(Locale, String) + */ public String getString(String localeAsString, String key) { return getString(Locale.forLanguageTag(localeAsString), key); }