|
|
@ -12,10 +12,10 @@ import com.fr.design.gui.itextfield.UITextField; |
|
|
|
import com.fr.file.filetree.FileNode; |
|
|
|
import com.fr.file.filetree.FileNode; |
|
|
|
import com.fr.general.GeneralUtils; |
|
|
|
import com.fr.general.GeneralUtils; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
|
|
|
|
import com.fr.locale.InterProviderFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.StableUtils; |
|
|
|
import com.fr.stable.bridge.StableFactory; |
|
|
|
|
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.resource.WorkResourceOutputStream; |
|
|
|
import com.fr.workspace.resource.WorkResourceOutputStream; |
|
|
@ -37,7 +37,6 @@ import java.util.List; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.Properties; |
|
|
|
import java.util.ResourceBundle; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.Vector; |
|
|
|
import java.util.Vector; |
|
|
|
|
|
|
|
|
|
|
@ -121,43 +120,26 @@ public class LocalePane extends BasicPane { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void initPredefinedProperties() { |
|
|
|
private void initPredefinedProperties() { |
|
|
|
|
|
|
|
|
|
|
|
Map<Locale, String> supportLocaleMap = Inter.getSupportLocaleMap(); |
|
|
|
Map<Locale, String> supportLocaleMap = InterProviderFactory.getProvider().getSupportLocaleMap(); |
|
|
|
|
|
|
|
|
|
|
|
String[] localeFiles = StableFactory.getLocaleFiles(); |
|
|
|
Map<String, String> map; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> sortKeys = new ArrayList<String>(); |
|
|
|
List<String> sortKeys = new ArrayList<String>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (String path : localeFiles) { |
|
|
|
map = InterProviderFactory.getProvider().getLocalBundle(Locale.SIMPLIFIED_CHINESE).getMap(); |
|
|
|
ResourceBundle chineseBundle = loadResourceBundle(path, Locale.SIMPLIFIED_CHINESE); |
|
|
|
sortKeys.addAll(map.keySet()); |
|
|
|
sortKeys.addAll(chineseBundle.keySet()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Collections.sort(sortKeys); |
|
|
|
Collections.sort(sortKeys); |
|
|
|
|
|
|
|
|
|
|
|
Map<Locale, List<ResourceBundle>> localeResourceBundleMap = new HashMap<Locale, List<ResourceBundle>>(); |
|
|
|
|
|
|
|
for (Map.Entry<Locale, String> entry : supportLocaleMap.entrySet()) { |
|
|
|
|
|
|
|
Locale locale = entry.getKey(); |
|
|
|
|
|
|
|
List<ResourceBundle> list = new ArrayList<>(); |
|
|
|
|
|
|
|
for (String path : localeFiles) { |
|
|
|
|
|
|
|
ResourceBundle chineseBundle = loadResourceBundle(path, locale); |
|
|
|
|
|
|
|
list.add(chineseBundle); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
localeResourceBundleMap.put(locale, list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<Locale, Vector<String>> data = new HashMap<Locale, Vector<String>>(); |
|
|
|
Map<Locale, Vector<String>> data = new HashMap<Locale, Vector<String>>(); |
|
|
|
for (Map.Entry<Locale, List<ResourceBundle>> entry : localeResourceBundleMap.entrySet()) { |
|
|
|
for (Locale locale : supportLocaleMap.keySet()) { |
|
|
|
Vector<String> column = new Vector<String>(); |
|
|
|
Vector<String> column = new Vector<String>(); |
|
|
|
List<ResourceBundle> rbs = entry.getValue(); |
|
|
|
|
|
|
|
for (String key : sortKeys) { |
|
|
|
for (String key : sortKeys) { |
|
|
|
column.add(readText(rbs, key)); |
|
|
|
column.add(InterProviderFactory.getProvider().getLocText(key)); |
|
|
|
} |
|
|
|
} |
|
|
|
data.put(entry.getKey(), column); |
|
|
|
data.put(locale, column); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Vector<String> keyVector = new Vector<String>(); |
|
|
|
Vector<String> keyVector = new Vector<String>(); |
|
|
|
keyVector.addAll(sortKeys); |
|
|
|
keyVector.addAll(sortKeys); |
|
|
|
|
|
|
|
|
|
|
@ -167,20 +149,7 @@ public class LocalePane extends BasicPane { |
|
|
|
predefineTableModel.addColumn(entry.getKey().getDisplayName(), entry.getValue()); |
|
|
|
predefineTableModel.addColumn(entry.getKey().getDisplayName(), entry.getValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String readText(List<ResourceBundle> 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 { |
|
|
|
private void initCustomProperties() throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
FileNode[] fileNodes = FRContext.getFileNodes().list(ProjectConstants.LOCALE_NAME); |
|
|
|
FileNode[] fileNodes = FRContext.getFileNodes().list(ProjectConstants.LOCALE_NAME); |
|
|
|