package net.lecousin.framework.locale;

import net.lecousin.framework.concurrent.synch.AsyncWork;
import net.lecousin.framework.exception.NoException;

/**
 * Implement ILocalizableString with a fixed value (not localized).
 */
public class FixedLocalizedString implements ILocalizableString {

	/** Constructor. */
	public FixedLocalizedString(String fixedString) {
		str = fixedString;
	}
	
	private String str;
	
	@Override
	public AsyncWork<String, NoException> localize(String[] languageTag) {
		return new AsyncWork<>(str, null);
	}
	
	@Override
	public AsyncWork<String, NoException> localize(String languageTag) {
		return new AsyncWork<>(str, null);
	}
	
	@Override
	public String localizeSync(String languageTag) {
		return str;
	}
	
	@Override
	public String localizeSync(String[] languageTag) {
		return str;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof FixedLocalizedString)) return false;
		return str.equals(((FixedLocalizedString)obj).str);
	}
	
	@Override
	public int hashCode() {
		return str.hashCode();
	}
	
}

@@ -31,17 +31,19 @@
 .locale;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -92,16 +92,17 @@
 yncWork;
+%0D
 %0Aimport 
@@ -150,13 +150,16 @@
 ion;
-%0A
+%0D%0A%0D
 %0A/**
+%0D
 %0A * 
@@ -226,12 +226,14 @@
 ed).
+%0D
 %0A */
+%0D
 %0Apub
@@ -294,17 +294,19 @@
 String %7B
-%0A
+%0D%0A%0D
 %0A%09/** Co
@@ -318,16 +318,17 @@
 ctor. */
+%0D
 %0A%09public
@@ -370,16 +370,17 @@
 tring) %7B
+%0D
 %0A%09%09str =
@@ -392,21 +392,24 @@
 dString;
+%0D
 %0A%09%7D
+%0D
 %0A%09
+%0D
 %0A%09privat
@@ -421,18 +421,20 @@
 ing str;
+%0D
 %0A%09
+%0D
 %0A%09@Overr
@@ -428,32 +428,33 @@
 ;%0D%0A%09%0D%0A%09@Override
+%0D
 %0A%09public AsyncWo
@@ -501,32 +501,33 @@
 %5D languageTag) %7B
+%0D
 %0A%09%09return new As
@@ -539,37 +539,40 @@
 rk%3C%3E(str, null);
+%0D
 %0A%09%7D
+%0D
 %0A%09
+%0D
 %0A%09@Override%0A%09pub
@@ -558,32 +558,33 @@
 %7D%0D%0A%09%0D%0A%09@Override
+%0D
 %0A%09public AsyncWo
@@ -629,32 +629,33 @@
 g languageTag) %7B
+%0D
 %0A%09%09return new As
@@ -675,21 +675,24 @@
 , null);
+%0D
 %0A%09%7D
+%0D
 %0A%09
+%0D
 %0A%09@Overr
@@ -686,32 +686,33 @@
 %7D%0D%0A%09%0D%0A%09@Override
+%0D
 %0A%09public String 
@@ -737,32 +737,33 @@
 g languageTag) %7B
+%0D
 %0A%09%09return str;%0A%09
@@ -752,37 +752,40 @@
 %7B%0D%0A%09%09return str;
+%0D
 %0A%09%7D
+%0D
 %0A%09
+%0D
 %0A%09@Override%0A%09pub
@@ -771,32 +771,33 @@
 %7D%0D%0A%09%0D%0A%09@Override
+%0D
 %0A%09public String 
@@ -832,16 +832,17 @@
 geTag) %7B
+%0D
 %0A%09%09retur
@@ -847,21 +847,24 @@
 urn str;
+%0D
 %0A%09%7D
+%0D
 %0A%09
+%0D
 %0A%09@Overr
@@ -858,32 +858,224 @@
 %7D%0D%0A%09%0D%0A%09@Override
+%0D%0A%09public AsyncWork%3CString, NoException%3E appLocalization() %7B%0D%0A%09%09return new AsyncWork%3C%3E(str, null);%0D%0A%09%7D%0D%0A%09%0D%0A%09@Override%0D%0A%09public String appLocalizationSync() %7B%0D%0A%09%09return str;%0D%0A%09%7D%0D%0A%09%0D%0A%09@Override%0D
 %0A%09public boolean
@@ -1095,16 +1095,17 @@
 t obj) %7B
+%0D
 %0A%09%09if (!
@@ -1156,16 +1156,17 @@
 n false;
+%0D
 %0A%09%09retur
@@ -1211,21 +1211,24 @@
 j).str);
+%0D
 %0A%09%7D
+%0D
 %0A%09
+%0D
 %0A%09@Overr
@@ -1230,16 +1230,17 @@
 Override
+%0D
 %0A%09public
@@ -1256,16 +1256,17 @@
 Code() %7B
+%0D
 %0A%09%09retur
@@ -1286,12 +1286,16 @@
 e();
+%0D
 %0A%09%7D
+%0D
 %0A%09
+%0D
 %0A%7D
+%0D
 %0A

improve perf for FixedLocalizedString.appLocalization