X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fnet%2Fsf%2Fopenrocket%2Futil%2FPrefs.java;h=16e338c4a7692597505dc76287a800d986d0d4a1;hb=bf771f9d4b5215b0036435eb19fc8c813f87c79d;hp=047db50c7ae3c1a65599be088552aacb9a87168b;hpb=da7a9ff299f7b1529f8ff9cba08e4be3f369937c;p=debian%2Fopenrocket diff --git a/src/net/sf/openrocket/util/Prefs.java b/src/net/sf/openrocket/util/Prefs.java index 047db50c..16e338c4 100644 --- a/src/net/sf/openrocket/util/Prefs.java +++ b/src/net/sf/openrocket/util/Prefs.java @@ -8,9 +8,11 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.MissingResourceException; import java.util.Properties; @@ -23,6 +25,7 @@ import net.sf.openrocket.database.Databases; import net.sf.openrocket.document.Simulation; import net.sf.openrocket.gui.main.ExceptionHandler; import net.sf.openrocket.gui.print.PrintSettings; +import net.sf.openrocket.l10n.L10N; import net.sf.openrocket.l10n.Translator; import net.sf.openrocket.logging.LogHelper; import net.sf.openrocket.material.Material; @@ -47,6 +50,16 @@ public class Prefs { private static final String SPLIT_CHARACTER = "|"; + private static final List SUPPORTED_LOCALES; + static { + List list = new ArrayList(); + for (String lang : new String[] { "en", "de", "es", "fr" }) { + list.add(new Locale(lang)); + } + SUPPORTED_LOCALES = Collections.unmodifiableList(list); + } + + /** * Whether to use the debug-node instead of the normal node. */ @@ -391,7 +404,24 @@ public class Prefs { ////////////////// - + public static List getSupportedLocales() { + return SUPPORTED_LOCALES; + } + + public static Locale getUserLocale() { + String locale = getString("locale", null); + return L10N.toLocale(locale); + } + + public static void setUserLocale(Locale l) { + if (l == null) { + putString("locale", null); + } else { + putString("locale", l.toString()); + } + } + + public static boolean getCheckUpdates() { return PREFNODE.getBoolean(CHECK_UPDATES, BuildPropertyHolder.DEFAULT_CHECK_UPDATES);