Add logging to translations to tell you how many were loaded

This commit is contained in:
libraryaddict 2018-02-16 10:58:58 +13:00
parent 0adc7ecd3a
commit ebb1fa3c35

@ -2,7 +2,6 @@ package me.libraryaddict.disguise.utilities;
import me.libraryaddict.disguise.DisguiseConfig; import me.libraryaddict.disguise.DisguiseConfig;
import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -89,6 +88,9 @@ public enum TranslateType {
for (String key : config.getKeys(false)) { for (String key : config.getKeys(false)) {
String value = config.getString(key); String value = config.getString(key);
if (Objects.equals(key, value))
continue;
if (value == null) if (value == null)
System.err.println("Translation for " + name() + " has a null value for the key '" + key + "'"); System.err.println("Translation for " + name() + " has a null value for the key '" + key + "'");
else { else {
@ -100,6 +102,10 @@ public enum TranslateType {
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
if (LibsPremium.isPremium() && DisguiseConfig.isUseTranslations()) {
System.out.println("[LibsDisguises] Loaded " + translated.size() + " translations for " + name());
}
} }
private File getFile() { private File getFile() {
@ -143,8 +149,8 @@ public enum TranslateType {
} }
} }
writer.write("\n" + (comment != null ? "# " + comment + "\n" : writer.write("\n" + (comment != null ? "# " + comment + "\n" : "") + "\"" + message + "\": \"" + message +
"") + "\"" + message + "\": \"" + message + "\"\n"); "\"\n");
} }
catch (Exception ex) { catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();