diff --git a/nicko-core/src/main/java/net/artelnatif/nicko/NickoBukkit.java b/nicko-core/src/main/java/net/artelnatif/nicko/NickoBukkit.java index 3d276ea..193be22 100644 --- a/nicko-core/src/main/java/net/artelnatif/nicko/NickoBukkit.java +++ b/nicko-core/src/main/java/net/artelnatif/nicko/NickoBukkit.java @@ -102,7 +102,7 @@ public class NickoBukkit extends JavaPlugin { saveDefaultConfig(); config = new NickoConfiguration(this); - LocaleManager.setDefaultLocale(this); + LocaleManager.setFallbackLocale(this); final PluginCommand command = getCommand("nicko"); if (command != null) { diff --git a/nicko-core/src/main/java/net/artelnatif/nicko/i18n/LocaleManager.java b/nicko-core/src/main/java/net/artelnatif/nicko/i18n/LocaleManager.java index a6bb2c6..4cd6c38 100644 --- a/nicko-core/src/main/java/net/artelnatif/nicko/i18n/LocaleManager.java +++ b/nicko-core/src/main/java/net/artelnatif/nicko/i18n/LocaleManager.java @@ -7,20 +7,20 @@ import java.util.Arrays; public class LocaleManager { private static final String[] supportedLocales = new String[]{"en", "fr", "custom"}; - public static void setDefaultLocale(NickoBukkit instance) { - final String locale = instance.getNickoConfig().getDefaultLocale(); + public static void setFallbackLocale(NickoBukkit instance) { + final String locale = instance.getNickoConfig().getFallbackLocale(); try { if (Arrays.stream(supportedLocales).noneMatch(s -> s.equalsIgnoreCase(locale))) { instance.getLogger().severe(locale + " is not a supported locale, defaulting to English."); - Locale.setDefault(Locale.ENGLISH); + Locale.setFallback(Locale.ENGLISH); return; } final Locale defaultLocale = Locale.fromCode(locale); - instance.getLogger().info("Default locale set to " + defaultLocale.getName() + "."); - Locale.setDefault(defaultLocale); + instance.getLogger().info("Fallback locale set to " + defaultLocale.getName() + "."); + Locale.setFallback(defaultLocale); } catch (Exception e) { instance.getLogger().severe(locale + " is not a valid locale, defaulting to English."); - Locale.setDefault(Locale.ENGLISH); + Locale.setFallback(Locale.ENGLISH); } } } diff --git a/nicko-core/src/main/resources/config.yml b/nicko-core/src/main/resources/config.yml index 0286449..667cc30 100644 --- a/nicko-core/src/main/resources/config.yml +++ b/nicko-core/src/main/resources/config.yml @@ -3,7 +3,7 @@ prefix: "§8[§6Nicko§8] " bungeecord: - # Enables Bungeecord support, switching through servers will keep player's skins. + # Enables Bungeecord support, switching through servers will transfer player's disguise. # Accepted values: false (Disabled), true (Enabled) enabled: false redis: @@ -13,10 +13,16 @@ bungeecord: ttl: -1 # Localisation: -# By default, Nicko tries to get the locale from the player's preferences. -# If that fails, the locale fallback is the one provided by this option. -# Accepted values: fr (French), en (English), custom (Custom language file). -locale: "en" +locale: + # By default, Nicko tries to get the locale from the player's preferences. + # If that fails, the locale fallback is the one provided by this option. + # Accepted values: fr (French), en (English), custom (Custom language file). + fallback: "en" + # Nicko will copy the English locale as "custom.yml" + # and will use the translations in that file when "Server Custom" + # is selected as the player's locale/default locale. + use_custom_locale: false + storage: # Indicates wherever the data will be stored