< prev index next >

src/jdk.incubator.jpackage/share/classes/jdk/incubator/jpackage/internal/I18N.java

Print this page

        

@@ -20,15 +20,38 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+package jdk.incubator.jpackage.internal;
 
-#include <windows.h>
+import java.util.ResourceBundle;
 
-extern "C" {
+class I18N {
 
-    BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
-            LPVOID lpvReserved) {
-        return true;
+    static String getString(String key) {
+        if (PLATFORM.containsKey(key)) {
+            return PLATFORM.getString(key);
+        }
+        return SHARED.getString(key);
+    }
+
+    private static final ResourceBundle SHARED = ResourceBundle.getBundle(
+            "jdk.incubator.jpackage.internal.resources.MainResources");
+
+    private static final ResourceBundle PLATFORM;
+
+    static {
+        if (Platform.isLinux()) {
+            PLATFORM = ResourceBundle.getBundle(
+                    "jdk.incubator.jpackage.internal.resources.LinuxResources");
+        } else if (Platform.isWindows()) {
+            PLATFORM = ResourceBundle.getBundle(
+                    "jdk.incubator.jpackage.internal.resources.WinResources");
+        } else if (Platform.isMac()) {
+            PLATFORM = ResourceBundle.getBundle(
+                    "jdk.incubator.jpackage.internal.resources.MacResources");
+        } else {
+            throw new IllegalStateException("Unknwon platform");
+        }
     }
 }
\ No newline at end of file
< prev index next >