From faf7d120019e420af8bba37d32ceb61ed0569810 Mon Sep 17 00:00:00 2001 From: Davide Polonio Date: Sat, 15 Apr 2023 13:05:09 +0200 Subject: [PATCH] docs: add Javadoc --- .../i18n/TemplateContentGenerator.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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); }