private static Configuration loadLanguageFile(final String locale) throws Exception{
final File langDir = getLanguagesDir();
File file = new File(langDir, locale + ".yml");
// check file available
if (file == null || !file.isFile() || !file.canRead()){
ActionLog.getInstance().warning("Unknown language file: " + locale);
return null;
}
YamlConfiguration conf = YamlConfiguration.loadConfiguration(file);
// check all messages available
if (fallbackMessages != null && conf.getKeys(true).size() != fallbackMessages.getKeys(true).size()){
// collect missing message keys
for (String key : fallbackMessages.getKeys(true)){
if (!conf.contains(key) && !fallbackMessages.isConfigurationSection(key)){
conf.set(key, fallbackMessages.get(key));
ActionLog.getInstance().warning("Missing message key on " + locale + ".yml: " + key);
}
}
}
return conf;
}
I18n.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:MCBansAssetGatway
作者:
评论列表
文章目录