X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2FL10nFilter.java;h=d667811d558b02cdc083515d9122920fabf4c80a;hp=ef6ef98a5c9003b355c925fc569a6f077194c4e4;hb=c9b4749797931ab804673640f4a15511900f150a;hpb=a10fb632973651096c8fdba923c932732d09eedc diff --git a/src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java b/src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java index ef6ef98..d667811 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java +++ b/src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java @@ -25,27 +25,21 @@ import java.util.Map; import javax.annotation.Nonnull; -import net.pterodactylus.sone.web.WebInterface; import net.pterodactylus.util.template.Filter; import net.pterodactylus.util.template.TemplateContext; +import freenet.l10n.BaseL10n; + /** * {@link Filter} implementation replaces {@link String} values with their * translated equivalents. */ public class L10nFilter implements Filter { - /** The web interface. */ - private final WebInterface webInterface; + private final BaseL10n l10n; - /** - * Creates a new L10n filter. - * - * @param webInterface - * The Sone web interface - */ - public L10nFilter(WebInterface webInterface) { - this.webInterface = webInterface; + public L10nFilter(BaseL10n l10n) { + this.l10n = l10n; } /** @@ -56,9 +50,9 @@ public class L10nFilter implements Filter { List parameterValues = getParameters(data, parameters); String text = getText(data); if (parameterValues.isEmpty()) { - return webInterface.getL10n().getString(text); + return l10n.getString(text); } - return new MessageFormat(webInterface.getL10n().getString(text), new Locale(webInterface.getL10n().getSelectedLanguage().shortCode)).format(parameterValues.toArray()); + return new MessageFormat(l10n.getString(text), new Locale(l10n.getSelectedLanguage().shortCode)).format(parameterValues.toArray()); } @Nonnull