projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
🔀 Merge branch 'release/v82'
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
template
/
UnknownDateFilter.java
diff --git
a/src/main/java/net/pterodactylus/sone/template/UnknownDateFilter.java
b/src/main/java/net/pterodactylus/sone/template/UnknownDateFilter.java
index
4fc95f7
..
2d6c05c
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/template/UnknownDateFilter.java
+++ b/
src/main/java/net/pterodactylus/sone/template/UnknownDateFilter.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - UnknownDateFilter.java - Copyright © 2011 David Roden
+ * Sone - UnknownDateFilter.java - Copyright © 2011
–2020
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
*
* 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
@@
-19,20
+19,18
@@
package net.pterodactylus.sone.template;
import java.util.Map;
import java.util.Map;
-import net.pterodactylus.
util.template.DataProvider
;
+import net.pterodactylus.
sone.freenet.Translation
;
import net.pterodactylus.util.template.Filter;
import net.pterodactylus.util.template.Filter;
-import
freenet.l10n.BaseL10n
;
+import
net.pterodactylus.util.template.TemplateContext
;
/**
* {@link Filter} implementation that replaces a {@link Long} with a value of
/**
* {@link Filter} implementation that replaces a {@link Long} with a value of
- * {@code 0} by a {@link String} from an {@link BaseL10n l10n handler}.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
+ * {@code 0} by a {@link String} from a {@link Translation translation}.
*/
public class UnknownDateFilter implements Filter {
*/
public class UnknownDateFilter implements Filter {
- /** The
l10n handler
. */
- private
BaseL10n l10nHandler
;
+ /** The
translation
. */
+ private
final Translation translation
;
/** The key for the text to show. */
private final String unknownKey;
/** The key for the text to show. */
private final String unknownKey;
@@
-40,13
+38,11
@@
public class UnknownDateFilter implements Filter {
/**
* Creates a new unknown date filter.
*
/**
* Creates a new unknown date filter.
*
- * @param l10nHandler
- * The l10n handler
- * @param unknownKey
- * The key of the text to show
+ * @param translation The translation
+ * @param unknownKey The key of the text to show
*/
*/
- public UnknownDateFilter(
BaseL10n l10nHandler
, String unknownKey) {
- this.
l10nHandler = l10nHandler
;
+ public UnknownDateFilter(
Translation translation
, String unknownKey) {
+ this.
translation = translation
;
this.unknownKey = unknownKey;
}
this.unknownKey = unknownKey;
}
@@
-54,10
+50,10
@@
public class UnknownDateFilter implements Filter {
* {@inheritDoc}
*/
@Override
* {@inheritDoc}
*/
@Override
- public Object format(
DataProvider dataProvider, Object data, Map<String, String
> parameters) {
+ public Object format(
TemplateContext templateContext, Object data, Map<String, Object
> parameters) {
if (data instanceof Long) {
if ((Long) data == 0) {
if (data instanceof Long) {
if ((Long) data == 0) {
- return
l10nHandler.getString
(unknownKey);
+ return
translation.translate
(unknownKey);
}
}
return data;
}
}
return data;