cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r412422 - /incubator/cayenne/main/branches/PROTO-3.0/modeler/swing-plugin/src/main/java/org/apache/cayenne/swing/plugin/frame/FramePlugin.java
Date Wed, 07 Jun 2006 15:12:13 GMT
Author: aadamchik
Date: Wed Jun  7 08:12:13 2006
New Revision: 412422

URL: http://svn.apache.org/viewvc?rev=412422&view=rev
Log:
adding back locale switching

Modified:
    incubator/cayenne/main/branches/PROTO-3.0/modeler/swing-plugin/src/main/java/org/apache/cayenne/swing/plugin/frame/FramePlugin.java

Modified: incubator/cayenne/main/branches/PROTO-3.0/modeler/swing-plugin/src/main/java/org/apache/cayenne/swing/plugin/frame/FramePlugin.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/PROTO-3.0/modeler/swing-plugin/src/main/java/org/apache/cayenne/swing/plugin/frame/FramePlugin.java?rev=412422&r1=412421&r2=412422&view=diff
==============================================================================
--- incubator/cayenne/main/branches/PROTO-3.0/modeler/swing-plugin/src/main/java/org/apache/cayenne/swing/plugin/frame/FramePlugin.java
(original)
+++ incubator/cayenne/main/branches/PROTO-3.0/modeler/swing-plugin/src/main/java/org/apache/cayenne/swing/plugin/frame/FramePlugin.java
Wed Jun  7 08:12:13 2006
@@ -17,6 +17,8 @@
 
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
+import java.util.StringTokenizer;
 
 import org.platonos.pluginengine.Extension;
 import org.platonos.pluginengine.PluginLifecycle;
@@ -32,8 +34,45 @@
 
     public static final String FRAME_BUILDERS_EXT = "frameBuilders";
 
+    /**
+     * A system property that defines application locale. If not set default system locae
+     * is used. This is used mostly for localization debugging.
+     */
+    public static final String LOCALE_PROPERTY = "cayenne.ui.locale";
+
     protected FrameBuilder frameBuilder;
     protected FrameController frameController;
+
+    /**
+     * Changes default locale if {@link #LOCALE_PROPERTY} is set.
+     */
+    protected void initialize() {
+        // change default locale
+        String locale = System.getProperty(LOCALE_PROPERTY);
+        if (locale != null) {
+
+            StringTokenizer toks = new StringTokenizer(locale, "_");
+
+            if (toks.hasMoreTokens()) {
+                // note that default local parts must be empty strings, not nulls...
+                String language = "";
+                String country = "";
+                String variant = "";
+
+                language = toks.nextToken();
+
+                if (toks.hasMoreTokens()) {
+                    country = toks.nextToken();
+
+                    if (toks.hasMoreTokens()) {
+                        variant = toks.nextToken();
+                    }
+                }
+
+                Locale.setDefault(new Locale(language, country, variant));
+            }
+        }
+    }
 
     protected void start() {
 



Mime
View raw message