diff --git a/designer_base/src/com/fr/design/actions/file/LocalePane.java b/designer_base/src/com/fr/design/actions/file/LocalePane.java index 3356fa70af..00bb7107cd 100644 --- a/designer_base/src/com/fr/design/actions/file/LocalePane.java +++ b/designer_base/src/com/fr/design/actions/file/LocalePane.java @@ -27,6 +27,8 @@ import com.fr.design.dialog.BasicPane; import com.fr.file.filetree.FileNode; import com.fr.general.*; import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import com.fr.stable.bridge.StableFactory; import com.fr.stable.project.ProjectConstants; /** @@ -51,8 +53,8 @@ public class LocalePane extends BasicPane { add(tabbedPane, BorderLayout.CENTER); predefineTableModel = new DefaultTableModel() { - public boolean isCellEditable(int col, int row) { - return false; + public boolean isCellEditable(int row, int column) { + return column == 0; } }; @@ -109,23 +111,39 @@ public class LocalePane extends BasicPane { } private void initPredefinedProperties() { - Map map = Inter.getPredefinedPackageMap(); - LocalePackage chinese = map.get(Locale.SIMPLIFIED_CHINESE); + + Map supportLocaleMap = Inter.getSupportLocaleMap(); + + String[] localeFiles = StableFactory.getLocaleFiles(); + + List sortKeys = new ArrayList(); - Set bundles = chinese.getKindsOfResourceBundle(); - for (ResourceBundle bundle : bundles) { - sortKeys.addAll(bundle.keySet()); + for (String path : localeFiles) { + ResourceBundle chineseBundle = loadResourceBundle(path, Locale.SIMPLIFIED_CHINESE); + sortKeys.addAll(chineseBundle.keySet()); } Collections.sort(sortKeys); + Map> localeResourceBundleMap = new HashMap>(); + for (Map.Entry entry : supportLocaleMap.entrySet()) { + Locale locale = entry.getKey(); + List list = new ArrayList<>(); + for (String path : localeFiles) { + ResourceBundle chineseBundle = loadResourceBundle(path, locale); + list.add(chineseBundle); + } + localeResourceBundleMap.put(locale, list); + } + Map> data = new HashMap>(); - for (Map.Entry entry : map.entrySet()) { + for (Map.Entry> entry : localeResourceBundleMap.entrySet()) { Vector column = new Vector(); + List rbs = entry.getValue(); for (String key : sortKeys) { - column.add(entry.getValue().getLocText(key)); + column.add(readText(rbs, key)); } data.put(entry.getKey(), column); } @@ -140,6 +158,19 @@ public class LocalePane extends BasicPane { } } + public String readText(List rbs, String key) { + for (ResourceBundle rb : rbs) { + if (rb.containsKey(key)) { + return rb.getString(key); + } + } + return null; + } + + private ResourceBundle loadResourceBundle(String dir, Locale locale) { + return ResourceBundle.getBundle(dir, locale, Inter.class.getClassLoader()); + } + private void initCustomProperties() throws Exception { Env env = FRContext.getCurrentEnv(); if (env == null) {