src/share/classes/java/awt/Toolkit.java

Print this page

        

@@ -1605,10 +1605,12 @@
      * Support for I18N: any visible strings should be stored in
      * sun.awt.resources.awt.properties.  The ResourceBundle is stored
      * here, so that only one copy is maintained.
      */
     private static ResourceBundle resources;
+    private static ResourceBundle platformResources;
+
 
     /**
      * Initialize JNI field and method ids
      */
     private static native void initIDs();

@@ -1653,17 +1655,32 @@
             loaded = true;
         }
     }
 
     static {
+        String osname = System.getProperty("os.name");
+
+        final String platformSuffix;
+        if (osname.contains("OS X")) {
+            platformSuffix = "osx";
+        }  else {
+            platformSuffix = null;
+        }
+
         java.security.AccessController.doPrivileged(
                                  new java.security.PrivilegedAction<Void>() {
             public Void run() {
                 try {
                     resources =
                         ResourceBundle.getBundle("sun.awt.resources.awt",
                                                  CoreResourceBundleControl.getRBControlInstance());
+                    if (platformSuffix != null) {
+                        platformResources =
+                            ResourceBundle.getBundle("sun.awt.resources.awt" + platformSuffix,
+                                                 CoreResourceBundleControl.getRBControlInstance());
+                    }
+
                 } catch (MissingResourceException e) {
                     // No resource file; defaults will be used.
                 }
                 return null;
             }

@@ -1680,10 +1697,19 @@
     /**
      * Gets a property with the specified key and default.
      * This method returns defaultValue if the property is not found.
      */
     public static String getProperty(String key, String defaultValue) {
+        // first try platform specific bundle
+        if (platformResources != null) {
+            try {
+                return platformResources.getString(key);
+            }
+            catch (MissingResourceException e) {}
+        }
+
+        // then shared one
         if (resources != null) {
             try {
                 return resources.getString(key);
             }
             catch (MissingResourceException e) {}