forked from Qortal/qortal
Added settings entry "localeLang" for controlling core language (not-API)
This commit is contained in:
parent
855cb2226a
commit
bed9837967
@ -10,12 +10,12 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.qortal.settings.Settings;
|
||||||
|
|
||||||
public enum Translator {
|
public enum Translator {
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(Translator.class);
|
private static final Logger LOGGER = LogManager.getLogger(Translator.class);
|
||||||
private static final String DEFAULT_LANG = Locale.getDefault().getLanguage();
|
|
||||||
|
|
||||||
private static final Map<String, ResourceBundle> resourceBundles = new HashMap<>();
|
private static final Map<String, ResourceBundle> resourceBundles = new HashMap<>();
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public enum Translator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String translate(String className, String key) {
|
public String translate(String className, String key) {
|
||||||
return this.translate(className, DEFAULT_LANG, key);
|
return this.translate(className, Settings.getInstance().getLocaleLang(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> keySet(String className, String lang) {
|
public Set<String> keySet(String className, String lang) {
|
||||||
|
@ -5,6 +5,7 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.JAXBException;
|
import javax.xml.bind.JAXBException;
|
||||||
@ -41,6 +42,9 @@ public class Settings {
|
|||||||
// Settings, and other config files
|
// Settings, and other config files
|
||||||
private String userPath;
|
private String userPath;
|
||||||
|
|
||||||
|
// General
|
||||||
|
private String localeLang = Locale.getDefault().getLanguage();
|
||||||
|
|
||||||
// Common to all networking (API/P2P)
|
// Common to all networking (API/P2P)
|
||||||
private String bindAddress = "::"; // Use IPv6 wildcard to listen on all local addresses
|
private String bindAddress = "::"; // Use IPv6 wildcard to listen on all local addresses
|
||||||
|
|
||||||
@ -261,6 +265,10 @@ public class Settings {
|
|||||||
return this.userPath;
|
return this.userPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLocaleLang() {
|
||||||
|
return this.localeLang;
|
||||||
|
}
|
||||||
|
|
||||||
public int getUiServerPort() {
|
public int getUiServerPort() {
|
||||||
return this.uiPort;
|
return this.uiPort;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user