New API to get a rendered translation in LocalizationManager

Hi devs,

I’d like to propose adding String getTranslation(String key, Locale locale, Syntax targetSyntax, Object... parameters) in LocalizationManager, as in:

    /**
     * Find a translation in the specified locale.
     * 
     * @param key the key identifying the message to look for
     * @param locale the {@link Locale} for which this translation is searched. The result might be associated to a
     *            different {@link Locale} (for example getting the {@code fr} translation when asking for the
     *            {@code fr_FR} one).
     * @param parameters the parameters
     * @return the translation in the defined language, rendered as plain text, null if no translation could be found
     * @see #getTranslation(String, Locale)
     * @since 14.1RC1
     * @since 13.10.3
     */
    default String getTranslationPlain(String key, Locale locale, Object... parameters)
    {
        return getTranslation(key, locale, Syntax.PLAIN_1_0, parameters);
    }

    /**
     * Find a translation in the specified locale.
     *
     * @param key the key identifying the message to look for
     * @param locale the {@link Locale} for which this translation is searched. The result might be associated to a
     *            different {@link Locale} (for example getting the {@code fr} translation when asking for the
     *            {@code fr_FR} one).
     * @param targetSyntax the syntax in which to render the translation
     * @param parameters the parameters
     * @return the translation in the defined language, rendered in the target syntax, null if no translation could be
     *         found
     * @see #getTranslation(String, Locale)
     * @since 15.5RC1
     * @since 14.10.2
     */
    default String getTranslation(String key, Locale locale, Syntax targetSyntax, Object... parameters)
    {
        return null;
    }

The rationale is to have some helper method to get a translation as a string and then to refactor the following places:

WDYT?

Thanks

+1

Implemented in Loading...