Store the locale files in their own "parent" folder, so it looks nicer, instead of having a prefix

also renamed BSBLocale#add() to BSBLocale#merge()
and renamed the locale files as well
This commit is contained in:
Florian CUNY 2018-01-04 14:14:18 +01:00
parent 4aaab9f69f
commit b7f1d68bcf
7 changed files with 6 additions and 4 deletions

View File

@ -62,10 +62,10 @@ public class BSBLocale {
}
/**
* Adds language YAML file to this locale
* Merges a language YAML file to this locale
* @param language
*/
public void add(File language) {
public void merge(File language) {
YamlConfiguration toBeMerged = YamlConfiguration.loadConfiguration(language);
for (String key : toBeMerged.getKeys(true)) {
if (!config.contains(key)) {

View File

@ -65,8 +65,9 @@ public final class LocalesManager {
return false;
}
};
// Run through the files and store the locales
File localeDir = new File(plugin.getDataFolder(), LOCALE_FOLDER);
File localeDir = new File(plugin.getDataFolder(), LOCALE_FOLDER + "/" + parent);
// If the folder does not exist, then make it and fill with the locale files from the jar
// If it does exist, then new files will NOT be written!
if (!localeDir.exists()) {
@ -80,6 +81,7 @@ public final class LocalesManager {
e.printStackTrace();
}
}
// Store all the locales available
for (File language : localeDir.listFiles(ymlFilter)) {
if (DEBUG)
@ -89,7 +91,7 @@ public final class LocalesManager {
plugin.getLogger().info("DEBUG: locale country found = " + localeObject.getCountry());
if (languages.containsKey(localeObject)) {
// Merge into current language
languages.get(localeObject).add(language);
languages.get(localeObject).merge(language);
} else {
// New language
languages.put(localeObject, new BSBLocale(localeObject, language));