diff --git a/pom.xml b/pom.xml
index 2166515..58dbb2a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,7 +12,7 @@
4.0.0
net.cactusthorn
localization
- 0.7
+ 0.8
jar
UTF-8
@@ -51,12 +51,12 @@
-
+
org.slf4j
slf4j-api
diff --git a/src/main/java/net/cactusthorn/localization/LoggingLocalization.java b/src/main/java/net/cactusthorn/localization/LoggingLocalization.java
index 0cce606..4ce4371 100644
--- a/src/main/java/net/cactusthorn/localization/LoggingLocalization.java
+++ b/src/main/java/net/cactusthorn/localization/LoggingLocalization.java
@@ -17,12 +17,12 @@
import java.util.Locale;
import java.util.Map;
-import lombok.extern.slf4j.Slf4j;
import net.cactusthorn.localization.core.LocalizationKey;
import net.cactusthorn.localization.core.LocalizationKeys;
-@Slf4j
public class LoggingLocalization extends BasicLocalization {
+
+ private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggingLocalization.class);
public LoggingLocalization(Map translations, String systemId, Path l10nDirectory, Charset charset) {
super(translations, systemId, l10nDirectory, charset);
diff --git a/src/main/java/net/cactusthorn/localization/WatchLoggingLocalization.java b/src/main/java/net/cactusthorn/localization/WatchLoggingLocalization.java
index a61f34a..35505bb 100644
--- a/src/main/java/net/cactusthorn/localization/WatchLoggingLocalization.java
+++ b/src/main/java/net/cactusthorn/localization/WatchLoggingLocalization.java
@@ -28,13 +28,13 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import lombok.extern.slf4j.Slf4j;
import net.cactusthorn.localization.core.LocalizationKeys;
-@Slf4j
//must be final, because start the thread in the constructor
public final class WatchLoggingLocalization extends LoggingLocalization implements Runnable {
+ private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(WatchLoggingLocalization.class);
+
private final WatchService watchService = FileSystems.getDefault().newWatchService();
private final Thread thread;
diff --git a/src/main/java/net/cactusthorn/localization/core/LocalizationKey.java b/src/main/java/net/cactusthorn/localization/core/LocalizationKey.java
index abef89d..4a39920 100644
--- a/src/main/java/net/cactusthorn/localization/core/LocalizationKey.java
+++ b/src/main/java/net/cactusthorn/localization/core/LocalizationKey.java
@@ -19,12 +19,10 @@
import org.apache.commons.text.translate.EntityArrays;
import org.apache.commons.text.translate.LookupTranslator;
-import lombok.ToString;
import net.cactusthorn.localization.LocalizationException;
import net.cactusthorn.localization.Parameter;
import net.cactusthorn.localization.formats.Formats;
-@ToString
public class LocalizationKey {
public static final String PS = "{{";
diff --git a/src/main/java/net/cactusthorn/localization/core/LocalizationKeys.java b/src/main/java/net/cactusthorn/localization/core/LocalizationKeys.java
index 39ab55a..f7bf56e 100644
--- a/src/main/java/net/cactusthorn/localization/core/LocalizationKeys.java
+++ b/src/main/java/net/cactusthorn/localization/core/LocalizationKeys.java
@@ -24,7 +24,7 @@ public class LocalizationKeys {
private Sys sys;
private Formats formats;
- private Map translations = new HashMap<>();
+ private Map $keys = new HashMap<>();
public LocalizationKeys(String systemId, String languageTag, Map properties) throws LocalizationException, ScriptException {
@@ -47,22 +47,22 @@ public void combineWith(LocalizationKeys keys ) {
sys.combineWith(keys.sys);
formats.combineWith(keys.formats);
- keys.translations.entrySet().forEach(e -> { if (translations.containsKey(e.getKey())) { translations.get(e.getKey()).combineWith(e.getValue()); } } );
- keys.translations.entrySet().forEach(e -> translations.putIfAbsent(e.getKey(), e.getValue() ) );
+ keys.$keys.entrySet().forEach(e -> { if ($keys.containsKey(e.getKey())) { $keys.get(e.getKey()).combineWith(e.getValue()); } } );
+ keys.$keys.entrySet().forEach(e -> $keys.putIfAbsent(e.getKey(), e.getValue() ) );
}
void addDefault(String key, String value, boolean escapeHtml) {
- if (!translations.containsKey(key ) ) {
- translations.put(key, new LocalizationKey(key));
+ if (!$keys.containsKey(key ) ) {
+ $keys.put(key, new LocalizationKey(key));
}
- translations.get(key).setDefault(value, escapeHtml );
+ $keys.get(key).setDefault(value, escapeHtml );
}
void addPluralSpecial(String key, int special, String value, boolean escapeHtml) {
- if (!translations.containsKey(key ) ) {
- translations.put(key, new LocalizationKey(key));
+ if (!$keys.containsKey(key ) ) {
+ $keys.put(key, new LocalizationKey(key));
}
- translations.get(key).addPluralSpecial(special, value, escapeHtml );
+ $keys.get(key).addPluralSpecial(special, value, escapeHtml );
}
void addPluralSpecial(String key, String special, String value, boolean escapeHtml) {
@@ -70,10 +70,10 @@ void addPluralSpecial(String key, String special, String value, boolean escapeHt
}
void addPlural(String key, int plural, String value, boolean escapeHtml) {
- if (!translations.containsKey(key ) ) {
- translations.put(key, new LocalizationKey(key));
+ if (!$keys.containsKey(key ) ) {
+ $keys.put(key, new LocalizationKey(key));
}
- translations.get(key).addPlural(plural, value, escapeHtml );
+ $keys.get(key).addPlural(plural, value, escapeHtml );
}
public void addPlural(String key, String plural, String value, boolean escapeHtml) {
@@ -97,7 +97,7 @@ public String get(String key, boolean withFormatting, Parameter>... parameters
}
public String get(String key, boolean withFormatting, final Map params) {
- LocalizationKey translation = translations.get(key);
+ LocalizationKey translation = $keys.get(key);
if (translation == null ) {
throw new LocalizationKeyException(sys.locale(), "unavailable key: " + key );
}
@@ -105,7 +105,7 @@ public String get(String key, boolean withFormatting, final Map param
}
public String getDefault(String key) {
- LocalizationKey translation = translations.get(key);
+ LocalizationKey translation = $keys.get(key);
if (translation == null ) {
throw new LocalizationKeyException(sys.locale(), "unavailable key: " + key );
}
diff --git a/src/main/java/net/cactusthorn/localization/core/Sys.java b/src/main/java/net/cactusthorn/localization/core/Sys.java
index a963b91..fd4873b 100644
--- a/src/main/java/net/cactusthorn/localization/core/Sys.java
+++ b/src/main/java/net/cactusthorn/localization/core/Sys.java
@@ -19,13 +19,11 @@
import javax.script.ScriptException;
import javax.script.SimpleBindings;
-import lombok.ToString;
import net.cactusthorn.localization.LocalizationException;
import javax.script.Compilable;
import javax.script.Bindings;
-@ToString(exclude="pluralScript")
class Sys {
private CompiledScript pluralScript;
@@ -110,4 +108,15 @@ String languageTag() {
boolean escapeHtml() {
return escapeHtml;
}
+
+ @Override
+ public String toString() {
+ return "Sys(id=" + id
+ + ", locale=" + locale
+ + ", nplurals=" + nplurals
+ + ", pluralExpression=" + pluralExpression
+ + ", escapeHtml=" + escapeHtml + ")";
+ }
+
+
}
diff --git a/src/main/java/net/cactusthorn/localization/formats/Formats.java b/src/main/java/net/cactusthorn/localization/formats/Formats.java
index 7c95035..587ce08 100644
--- a/src/main/java/net/cactusthorn/localization/formats/Formats.java
+++ b/src/main/java/net/cactusthorn/localization/formats/Formats.java
@@ -23,10 +23,8 @@
import java.util.Locale;
import java.util.Map;
-import lombok.ToString;
import net.cactusthorn.localization.LocalizationFormatException;
-@ToString
public class Formats {
private Locale locale;