Move the languages to their own folder
Moving to a new translation service, so I need to do this.
This commit is contained in:
		@@ -50,7 +50,7 @@ public class JailIO {
 | 
				
			|||||||
    protected void loadLanguage() {
 | 
					    protected void loadLanguage() {
 | 
				
			||||||
        String language = pl.getConfig().getString(Settings.LANGUAGE.getPath());
 | 
					        String language = pl.getConfig().getString(Settings.LANGUAGE.getPath());
 | 
				
			||||||
        boolean save = false;
 | 
					        boolean save = false;
 | 
				
			||||||
        File langFile = new File(pl.getDataFolder(), language + ".yml");
 | 
					        File langFile = new File(pl.getDataFolder() + File.separator + "locales", language + ".yml");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //File or folder already exists, let's check
 | 
					        //File or folder already exists, let's check
 | 
				
			||||||
        if(langFile.exists()) {
 | 
					        if(langFile.exists()) {
 | 
				
			||||||
@@ -60,23 +60,23 @@ public class JailIO {
 | 
				
			|||||||
            }else {
 | 
					            }else {
 | 
				
			||||||
                pl.getLogger().severe("The language file can not be a folder.");
 | 
					                pl.getLogger().severe("The language file can not be a folder.");
 | 
				
			||||||
                pl.getLogger().severe("As a result, we are reverting back to English as the language.");
 | 
					                pl.getLogger().severe("As a result, we are reverting back to English as the language.");
 | 
				
			||||||
                Lang.setFile(YamlConfiguration.loadConfiguration(pl.getResource("en.yml")));
 | 
					                Lang.setFile(YamlConfiguration.loadConfiguration(pl.getResource("locales/en.yml")));
 | 
				
			||||||
                save = true;
 | 
					                save = true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }else {
 | 
					        }else {
 | 
				
			||||||
            pl.getLogger().warning("Loading the default language of: en");
 | 
					            pl.getLogger().warning("Loading the default language of: en");
 | 
				
			||||||
            pl.getLogger().warning("If you wish to change this, please rename 'en.yml' to whatever you wish and set the config value to the name of the file.");
 | 
					            pl.getLogger().warning("If you wish to change this, please rename 'en.yml' to whatever you wish and set the config value to the name of the file.");
 | 
				
			||||||
            Lang.setFile(YamlConfiguration.loadConfiguration(pl.getResource("en.yml")));
 | 
					            Lang.setFile(YamlConfiguration.loadConfiguration(pl.getResource("locales/en.yml")));
 | 
				
			||||||
            save = true;
 | 
					            save = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //Make sure we have all the new language settings loaded
 | 
					        //Make sure we have all the new language settings loaded
 | 
				
			||||||
        if(!save) save = Lang.writeNewLanguage(YamlConfiguration.loadConfiguration(pl.getResource("en.yml")));
 | 
					        if(!save) save = Lang.writeNewLanguage(YamlConfiguration.loadConfiguration(pl.getResource("locales/en.yml")));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //If we have flagged to save the language file, let's save it as en.yml as this flag usually means they didn't have it loaded.
 | 
					        //If we have flagged to save the language file, let's save it as en.yml as this flag usually means they didn't have it loaded.
 | 
				
			||||||
        if(save) {
 | 
					        if(save) {
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                Lang.getFile().save(new File(pl.getDataFolder(), "en.yml"));
 | 
					                Lang.getFile().save(new File(pl.getDataFolder() + File.separator + "locales", "en.yml"));
 | 
				
			||||||
            } catch (IOException e) {
 | 
					            } catch (IOException e) {
 | 
				
			||||||
                pl.getLogger().severe("Unable to save the language file: " + e.getMessage() + " (" + e.getClass().getSimpleName() + ")");
 | 
					                pl.getLogger().severe("Unable to save the language file: " + e.getMessage() + " (" + e.getClass().getSimpleName() + ")");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -114,7 +114,7 @@ public class TestInstanceCreator {
 | 
				
			|||||||
            logger.set(main, new PluginLogger(main));
 | 
					            logger.set(main, new PluginLogger(main));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            doReturn(getClass().getClassLoader().getResourceAsStream("config.yml")).when(main).getResource("config.yml");
 | 
					            doReturn(getClass().getClassLoader().getResourceAsStream("config.yml")).when(main).getResource("config.yml");
 | 
				
			||||||
            doReturn(getClass().getClassLoader().getResourceAsStream("en.yml")).when(main).getResource("en.yml");
 | 
					            doReturn(getClass().getClassLoader().getResourceAsStream("locales/en.yml")).when(main).getResource("locales/en.yml");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Add Jail to the list of loaded plugins
 | 
					            // Add Jail to the list of loaded plugins
 | 
				
			||||||
            JavaPlugin[] plugins = new JavaPlugin[] { main };
 | 
					            JavaPlugin[] plugins = new JavaPlugin[] { main };
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user