docs: add Javadoc
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details

pull/3/head
Davide Polonio 2023-04-15 13:05:09 +02:00
parent 8dd547404d
commit faf7d12001
1 changed files with 18 additions and 1 deletions

View File

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