Added localization classes and the start of the localization process.

This commit is contained in:
Krazy
2014-08-08 01:05:03 +00:00
parent 1ca0428ae9
commit c26de845e1
9 changed files with 181 additions and 48 deletions

View File

@@ -38,6 +38,7 @@ import forge.quest.QuestController;
import forge.quest.QuestWorld;
import forge.quest.data.QuestPreferences;
import forge.util.FileUtil;
import forge.util.Localizer;
import forge.util.storage.IStorage;
import forge.util.storage.StorageBase;
@@ -74,6 +75,18 @@ public class FModel {
private static GameFormat.Collection formats;
public static void initialize(final IProgressBar progressBar) {
// Instantiate preferences: quest and regular
//Preferences are initialized first so that the splash screen can be translated.
try {
preferences = new ForgePreferences();
}
catch (final Exception exn) {
throw new RuntimeException(exn);
}
Localizer.getInstance().initialize(FModel.getPreferences().getPref(FPref.UI_LANGUAGE), ForgeConstants.LANG_DIR);
//load card database
final ProgressObserver progressBarBridge = (progressBar == null) ?
ProgressObserver.emptyObserver : new ProgressObserver() {
@@ -115,14 +128,6 @@ public class FModel {
}
}
// Instantiate preferences: quest and regular
try {
preferences = new ForgePreferences();
}
catch (final Exception exn) {
throw new RuntimeException(exn);
}
ForgePreferences.DEV_MODE = preferences.getPrefBoolean(FPref.DEV_MODE_ENABLED);
ForgePreferences.UPLOAD_DRAFT = ForgePreferences.NET_CONN; // && preferences.getPrefBoolean(FPref.UI_UPLOAD_DRAFT);
@@ -139,7 +144,7 @@ public class FModel {
FThreads.invokeInEdtLater(new Runnable() {
@Override
public void run() {
progressBar.setDescription("Loading decks...");
progressBar.setDescription(Localizer.getInstance().getMessage("splash.loading.decks"));
}
});
}

View File

@@ -17,11 +17,11 @@
*/
package forge.properties;
import forge.GuiBase;
import java.util.Collections;
import java.util.Map;
import forge.GuiBase;
public final class ForgeConstants {
public static final String ASSETS_DIR = GuiBase.getInterface().getAssetsDir();
public static final String PROFILE_FILE = ASSETS_DIR + "forge.profile.properties";
@@ -56,6 +56,7 @@ public final class ForgeConstants {
public static final String AI_PROFILE_DIR = RES_DIR + "ai/";
public static final String SOUND_DIR = RES_DIR + "sound/";
public static final String MUSIC_DIR = RES_DIR + "music/";
public static final String LANG_DIR = RES_DIR + "languages/";
public static final String EFFECTS_DIR = RES_DIR + "effects/";
private static final String QUEST_DIR = RES_DIR + "quest/";

View File

@@ -79,6 +79,8 @@ public class ForgePreferences extends PreferencesStore<ForgePreferences.FPref> {
UI_VIBRATE_ON_LIFE_LOSS("true"),
UI_VIBRATE_ON_LONG_PRESS("true"),
UI_LANGUAGE("en-US"),
MATCHPREF_PROMPT_FREE_BLOCKS("false"),