Skip to content

Commit 584732e

Browse files
committed
fallback to local locale not english by default
1 parent 7275f67 commit 584732e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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 ("en_us".equals(locale)) {
394+
if (plugin.getConfiguration().getString("language").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("en_us");
401+
return forLocale(plugin.getConfiguration().getString("language"));
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("en_us");
425+
return forLocale(plugin.getConfiguration().getString("language"));
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 ("en_us".equals(locale)) {
511+
if (plugin.getConfiguration().getString("language").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("en_us");
518+
return forLocale(plugin.getConfiguration().getString("language"));
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("en_us");
540+
return forLocale(plugin.getConfiguration().getString("language"));
541541
}
542542
}
543543

src/main/resources/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
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
67
language: en_us
78

89
#This language will used by Item Name, Enchantment Name,

0 commit comments

Comments
 (0)