diff --git a/src/main/java/net/knarcraft/permissionsigns/PermissionSigns.java b/src/main/java/net/knarcraft/permissionsigns/PermissionSigns.java index 6da75b1..cceea99 100644 --- a/src/main/java/net/knarcraft/permissionsigns/PermissionSigns.java +++ b/src/main/java/net/knarcraft/permissionsigns/PermissionSigns.java @@ -133,7 +133,6 @@ public final class PermissionSigns extends JavaPlugin { public void onEnable() { PluginDescriptionFile pluginDescriptionFile = this.getDescription(); pluginVersion = pluginDescriptionFile.getVersion(); - //TODO: Allow for custom language files. Perhaps just look for strings.yml in the folder //TODO: Display a notice in the console if a new version is available FileConfiguration config = this.getConfig(); diff --git a/src/main/java/net/knarcraft/permissionsigns/formatting/Translator.java b/src/main/java/net/knarcraft/permissionsigns/formatting/Translator.java index 6da4a9d..c6ab28f 100644 --- a/src/main/java/net/knarcraft/permissionsigns/formatting/Translator.java +++ b/src/main/java/net/knarcraft/permissionsigns/formatting/Translator.java @@ -5,7 +5,10 @@ import net.knarcraft.permissionsigns.utility.FileHelper; import org.bukkit.configuration.file.YamlConfiguration; import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; @@ -23,7 +26,10 @@ public final class Translator { */ public static void loadLanguages(String selectedLanguage) { backupTranslatedMessages = loadTranslatedMessages("en"); - translatedMessages = loadTranslatedMessages(selectedLanguage); + translatedMessages = loadCustomTranslatedMessages(selectedLanguage); + if (translatedMessages == null) { + translatedMessages = loadTranslatedMessages(selectedLanguage); + } } /** @@ -52,14 +58,46 @@ public final class Translator { * @return
A mapping of all strings for the given language
*/ public static MapThe selected language
+ * @returnThe loaded translated strings, or null if no custom language file exists
+ */ + public static MapThe selected language
+ * @param readerThe buffered reader to read from
+ * @returnThe loaded translated strings
+ */ + private static Map