mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 18:55:17 +01:00
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:
parent
4aaab9f69f
commit
b7f1d68bcf
@ -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)) {
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user