X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=inline;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2FL10nFilter.java;h=d667811d558b02cdc083515d9122920fabf4c80a;hb=d0035d64e2acd25cc76c6d0bdb577cf206d259a9;hp=16dc9fbe280c169c79cd6e7b6e9e8f602cf3d49c;hpb=c41176c97933de44f2d2df08249429cb427b2978;p=Sone.git
diff --git a/src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java b/src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java
index 16dc9fb..d667811 100644
--- a/src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java
+++ b/src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java
@@ -1,5 +1,5 @@
/*
- * Sone - L10nFilter.java - Copyright © 2010 David Roden
+ * Sone - L10nFilter.java - Copyright © 2010â2019 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,51 +23,56 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
-import net.pterodactylus.sone.web.WebInterface;
+import javax.annotation.Nonnull;
+
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.
- *
- * @author David âBombeâ Roden
*/
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;
}
/**
* {@inheritDoc}
*/
@Override
- public String format(TemplateContext templateContext, Object data, Map parameters) {
- if (parameters.isEmpty()) {
- return webInterface.getL10n().getString(String.valueOf(data));
+ public String format(TemplateContext templateContext, Object data, Map parameters) {
+ List