Skip to content

Commit 414f2d5

Browse files
committed
remove language setting
1 parent 27e6d3e commit 414f2d5

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/main/java/org/maxgamer/quickshop/QuickShop.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,9 +1953,7 @@ private void updateConfig(int selectedVersion) throws IOException {
19531953
if (selectedVersion == 146) {
19541954
// Updater set it to true because plugin upgrading
19551955
// Default configuration disable it cause probably fresh install
1956-
if (StringUtils.isEmpty(getConfiguration().getString("language"))) {
1957-
getConfiguration().set("language", "en_us");
1958-
}
1956+
getConfiguration().set("language", null);
19591957
getConfiguration().set("config-version", ++selectedVersion);
19601958
}
19611959
if (getConfiguration().getInt("matcher.work-type") != 0 && GameVersion.get(ReflectFactory.getServerVersion()).name().contains("1_16")) {

src/main/java/org/maxgamer/quickshop/localization/text/SimpleTextManager.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,14 @@ private List<String> postProcess(@NotNull List<String> text) {
391391
public List<String> forLocale(@NotNull String locale) {
392392
JsonConfiguration index = mapping.get(locale);
393393
if (index == null) {
394-
if (plugin.getConfiguration().getString("language").equals(locale)) {
394+
if (MsgUtil.processGameLanguageCode(plugin.getConfiguration().getOrDefault("game-language", "default")).equals(locale)) {
395395
List<String> str = fallbackLocal();
396396
if (str.isEmpty()) {
397397
return Collections.singletonList("Fallback Missing Language Key: " + path + ", report to QuickShop!");
398398
}
399399
return postProcess(str);
400400
} else {
401-
return forLocale(plugin.getConfiguration().getString("language"));
401+
return forLocale(MsgUtil.processGameLanguageCode(plugin.getConfiguration().getOrDefault("game-language", "default")));
402402
}
403403
} else {
404404
List<String> str = index.getStringList(path);
@@ -422,7 +422,7 @@ public List<String> forLocale() {
422422
if (sender instanceof Player) {
423423
return forLocale(((Player) sender).getLocale());
424424
} else {
425-
return forLocale(plugin.getConfiguration().getString("language"));
425+
return forLocale(MsgUtil.processGameLanguageCode(plugin.getConfiguration().getOrDefault("game-language", "default")));
426426
}
427427
}
428428

@@ -508,14 +508,14 @@ private String postProcess(@NotNull String text) {
508508
public String forLocale(@NotNull String locale) {
509509
JsonConfiguration index = mapping.get(locale);
510510
if (index == null) {
511-
if (plugin.getConfiguration().getString("language").equals(locale)) {
511+
if (MsgUtil.processGameLanguageCode(plugin.getConfiguration().getOrDefault("game-language", "default")).equals(locale)) {
512512
String str = fallbackLocal();
513513
if (str == null) {
514514
return "Fallback Missing Language Key: " + path + ", report to QuickShop!";
515515
}
516516
return postProcess(str);
517517
} else {
518-
return forLocale(plugin.getConfiguration().getString("language"));
518+
return forLocale(MsgUtil.processGameLanguageCode(plugin.getConfiguration().getOrDefault("game-language", "default")));
519519
}
520520
} else {
521521
String str = index.getString(path);
@@ -537,7 +537,7 @@ public String forLocale() {
537537
if (sender instanceof Player) {
538538
return forLocale(((Player) sender).getLocale());
539539
} else {
540-
return forLocale(plugin.getConfiguration().getString("language"));
540+
return forLocale(MsgUtil.processGameLanguageCode(plugin.getConfiguration().getOrDefault("game-language", "default")));
541541
}
542542
}
543543

src/main/resources/config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
#Do not touch this if you don't know what you're doing!
44
config-version: 147
55

6-
#This option used for sign text and language fallback
7-
language: en_us
8-
96
#This language will used by Item Name, Enchantment Name,
107
#and Potion Effect Name or the text on the shop info sign (nbtapi not installed) and other them related position.
118
#Use default will use your system language.

0 commit comments

Comments
 (0)