From f7c12ec7513e5eed6106fa5a8d7af1274ba2f04f Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 7 Nov 2016 18:27:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E5=9C=A8web=E7=AB=AF=E4=B9=9F=E8=83=BD=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/LocalePane.java | 75 +++++++------------ 1 file changed, 28 insertions(+), 47 deletions(-) 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 27dad46df..3356fa70a 100644 --- a/designer_base/src/com/fr/design/actions/file/LocalePane.java +++ b/designer_base/src/com/fr/design/actions/file/LocalePane.java @@ -8,13 +8,7 @@ import java.awt.BorderLayout; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.Set; -import java.util.Vector; +import java.util.*; import javax.swing.JTable; import javax.swing.RowFilter; @@ -31,10 +25,7 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.dialog.BasicPane; import com.fr.file.filetree.FileNode; -import com.fr.general.FRLogger; -import com.fr.general.GeneralUtils; -import com.fr.general.IOUtils; -import com.fr.general.Inter; +import com.fr.general.*; import com.fr.stable.ArrayUtils; import com.fr.stable.project.ProjectConstants; @@ -43,12 +34,6 @@ import com.fr.stable.project.ProjectConstants; * @since : 8.0 */ public class LocalePane extends BasicPane { - private static final String FR = "fr.properties"; - private static final String US = "fr_en_US.properties"; - private static final String CN = "fr_zh_CN.properties"; - private static final String JP = "fr_ja_JP.properties"; - private static final String TW = "fr_zh_TW.properties"; - private static final String KR = "fr_ko_KR.properties"; private static final String PREFIX = "fr_"; private static final int LOCALE_NAME_LEN = 5; @@ -124,39 +109,35 @@ public class LocalePane extends BasicPane { } private void initPredefinedProperties() { - Properties fr = loadLocaleProperties(FR); - Properties us = loadLocaleProperties(US); - Properties cn = loadLocaleProperties(CN); - Properties jp = loadLocaleProperties(JP); - Properties tw = loadLocaleProperties(TW); - Properties kr = loadLocaleProperties(KR); - - Set keys = fr.stringPropertyNames(); - List sortKeys = new ArrayList(keys); + Map map = Inter.getPredefinedPackageMap(); + LocalePackage chinese = map.get(Locale.SIMPLIFIED_CHINESE); + + List sortKeys = new ArrayList(); + + + Set bundles = chinese.getKindsOfResourceBundle(); + for (ResourceBundle bundle : bundles) { + sortKeys.addAll(bundle.keySet()); + } Collections.sort(sortKeys); - Vector keyVector = new Vector(); - Vector valueVector = new Vector(); - Vector usVector = new Vector(); - Vector cnVector = new Vector(); - Vector jpVector = new Vector(); - Vector twVector = new Vector(); - Vector krVector = new Vector(); - for (String key : sortKeys) { - keyVector.add(key); - valueVector.add(fr.getProperty(key)); - usVector.add(us.getProperty(key)); - cnVector.add(cn.getProperty(key)); - jpVector.add(jp.getProperty(key)); - twVector.add(tw.getProperty(key)); - krVector.add(kr.getProperty(key)); + + Map> data = new HashMap>(); + for (Map.Entry entry : map.entrySet()) { + Vector column = new Vector(); + for (String key : sortKeys) { + column.add(entry.getValue().getLocText(key)); + } + data.put(entry.getKey(), column); } + + Vector keyVector = new Vector(); + keyVector.addAll(sortKeys); + + predefineTableModel.addColumn(Inter.getLocText("Key"), keyVector); - predefineTableModel.addColumn(Inter.getLocText("Value"), valueVector); - predefineTableModel.addColumn("en_US", usVector); - predefineTableModel.addColumn("zh_CN", cnVector); - predefineTableModel.addColumn("ja_JP", jpVector); - predefineTableModel.addColumn("zh_TW", twVector); - predefineTableModel.addColumn("ko_KR", krVector); + for (Map.Entry> entry : data.entrySet()) { + predefineTableModel.addColumn(entry.getKey().getDisplayName(), entry.getValue()); + } } private void initCustomProperties() throws Exception {