75 lines
2.0 KiB
Java
75 lines
2.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*/
|
|
package javax.baja.util;
|
|
|
|
import java.text.MessageFormat;
|
|
import javax.baja.sys.BModule;
|
|
import javax.baja.sys.Context;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
import javax.baja.util.Lexicon;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public class LexiconText {
|
|
public final BModule module;
|
|
public final String key;
|
|
private String defaultLang;
|
|
private String defaultContext;
|
|
|
|
public static LexiconText make(Type type, String string) {
|
|
return LexiconText.make(type.getModule(), string);
|
|
}
|
|
|
|
public static LexiconText make(BModule bModule, String string) {
|
|
return new LexiconText(bModule, string);
|
|
}
|
|
|
|
public static LexiconText make(String string, String string2) {
|
|
return LexiconText.make(Lexicon.module(string), string2);
|
|
}
|
|
|
|
public String get(Context context, String string) {
|
|
if (context == null) {
|
|
if (!this.defaultLang.equals(Sys.getLanguage())) {
|
|
this.defaultLang = Sys.getLanguage();
|
|
this.defaultContext = Lexicon.make(this.module, context).get(this.key);
|
|
}
|
|
if (this.defaultContext == null) {
|
|
return string;
|
|
}
|
|
return this.defaultContext;
|
|
}
|
|
String string2 = Lexicon.make(this.module, context).get(this.key);
|
|
if (string2 == null) {
|
|
return string;
|
|
}
|
|
return string2;
|
|
}
|
|
|
|
public String getText(Context context) {
|
|
return this.get(context, this.key);
|
|
}
|
|
|
|
public String getText(Context context, Object[] objectArray) {
|
|
String string = this.get(context, null);
|
|
if (string == null) {
|
|
return this.key;
|
|
}
|
|
return MessageFormat.format(string, objectArray);
|
|
}
|
|
|
|
private final /* synthetic */ void this() {
|
|
this.defaultLang = "???";
|
|
}
|
|
|
|
protected LexiconText(BModule bModule, String string) {
|
|
this.this();
|
|
this.module = bModule;
|
|
this.key = string;
|
|
}
|
|
}
|
|
|