mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 14:15:50 +01:00
Fix locale loading when setting is empty
This commit is contained in:
parent
a5253da44e
commit
585cbb2888
@ -318,19 +318,22 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
|||||||
|
|
||||||
private void setupTranslator() {
|
private void setupTranslator() {
|
||||||
Locale locale = Locale.getDefault();
|
Locale locale = Locale.getDefault();
|
||||||
String[] parts = Setting.LOCALE.asString().split("[\\._]");
|
String setting = Setting.LOCALE.asString();
|
||||||
switch (parts.length) {
|
if (!setting.isEmpty()) {
|
||||||
case 1:
|
String[] parts = setting.split("[\\._]");
|
||||||
locale = new Locale(parts[0]);
|
switch (parts.length) {
|
||||||
break;
|
case 1:
|
||||||
case 2:
|
locale = new Locale(parts[0]);
|
||||||
locale = new Locale(parts[0], parts[1]);
|
break;
|
||||||
break;
|
case 2:
|
||||||
case 3:
|
locale = new Locale(parts[0], parts[1]);
|
||||||
locale = new Locale(parts[0], parts[1], parts[2]);
|
break;
|
||||||
break;
|
case 3:
|
||||||
default:
|
locale = new Locale(parts[0], parts[1], parts[2]);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Translator.setInstance(new File(getDataFolder(), "lang"), locale);
|
Translator.setInstance(new File(getDataFolder(), "lang"), locale);
|
||||||
Messaging.logTr(Messages.LOCALE_NOTIFICATION, locale);
|
Messaging.logTr(Messages.LOCALE_NOTIFICATION, locale);
|
||||||
|
Loading…
Reference in New Issue
Block a user