9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-21 16:09:21 +00:00

added supported languages

This commit is contained in:
XiaoMoMi
2024-10-12 21:14:17 +08:00
parent cdf62d2262
commit 2a196760ff
5 changed files with 10 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.translation.Translator;
import net.momirealms.customcrops.common.helper.AdventureHelper;
import net.momirealms.customcrops.common.plugin.CustomCropsPlugin;
import net.momirealms.customcrops.common.plugin.CustomCropsProperties;
import net.momirealms.customcrops.common.util.Pair;
import org.jetbrains.annotations.Nullable;
@@ -38,7 +39,6 @@ import java.util.stream.Stream;
public class TranslationManager {
public static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
private static final List<String> locales = List.of("en", "zh_cn");
private static TranslationManager instance;
private static Locale FORCE_LOCALE = null;
@@ -63,7 +63,9 @@ public class TranslationManager {
MiniMessageTranslator.translator().removeSource(this.registry);
this.installed.clear();
}
for (String lang : locales) {
String supportedLocales = CustomCropsProperties.getValue("lang");
for (String lang : supportedLocales.split(",")) {
this.plugin.getConfigManager().saveResource("translations/" + lang + ".yml");
}

View File

@@ -18,3 +18,4 @@ caffeine=${caffeine_version}
exp4j=${exp4j_version}
slf4j=${slf4j_version}
zstd-jni=${zstd_version}
lang=${lang}

View File

@@ -1,4 +1,4 @@
# Don"t change this
# Don't change this
config-version: "41"
season.spring: "Spring"

View File

@@ -4,6 +4,9 @@ project_version=3.6.16
config_version=41
project_group=net.momirealms
# Supported languages
lang=en,zh_cn
# Dependency settings
paper_version=1.20.4
jetbrains_annotations_version=24.0.0