Unit tests for i18n component.

This commit is contained in:
akwizgran
2011-07-01 13:11:59 +01:00
parent a5bb959635
commit 6384256c06
7 changed files with 125 additions and 11 deletions

View File

@@ -121,8 +121,11 @@ public class I18nImpl implements I18n {
}
public void loadLocale() throws IOException {
File root = FileUtils.getBriarDirectory();
Scanner s = new Scanner(new File(root, "Data/locale.cfg"));
loadLocale(FileUtils.getBriarDirectory());
}
public void loadLocale(File dir) throws IOException {
Scanner s = new Scanner(new File(dir, "Data/locale.cfg"));
if(s.hasNextLine()) setLocale(new Locale(s.nextLine()));
s.close();
}
@@ -132,7 +135,7 @@ public class I18nImpl implements I18n {
}
public void saveLocale(File dir) throws IOException {
File localeCfg = new File(dir, "locale.cfg");
File localeCfg = new File(dir, "Data/locale.cfg");
FileOutputStream out = new FileOutputStream(localeCfg);
PrintStream print = new PrintStream(out);
print.println(locale);

View File

@@ -82,7 +82,7 @@ class SetupWorker implements Runnable {
createLaunchers(dir);
if(callback.isCancelled()) return;
// Save the chosen locale for the first launch
i18n.saveLocale(data);
i18n.saveLocale(dir);
if(callback.isCancelled()) return;
// Installation succeeded - delete the installer
jar.deleteOnExit();