📄 additionalresourcemanager.java
字号:
package org.enhydra.jawe;import java.util.ArrayList;import java.util.Iterator;import java.util.List;import java.util.Locale;import java.util.Properties;import java.util.ResourceBundle;/** * Utility for implementing multi language support. * * @author Sasa Bojanic */public class AdditionalResourceManager { public static final String ADDITIONAL_LANGUAGE_PROPERTY_FILE = "AdditionalLanguagePropertyFile."; protected List propertyFiles = new ArrayList(); public AdditionalResourceManager(Properties props) { List apfs = ResourceManager.getResourceStrings(props, ADDITIONAL_LANGUAGE_PROPERTY_FILE); if (apfs != null) { for (int i = 0; i < apfs.size(); i++) { String pf = (String) apfs.get(i); try { ResourceBundle bundle = ResourceBundle.getBundle(pf, ResourceManager.getChoosenLocale()); propertyFiles.add(bundle); } catch (Exception mre) { Properties eps = new Properties(); try { Utils.manageProperties(eps, getCurrentConfigFolder(), pf); } catch (Exception ex) { } String locStrOrig = pf.substring(0, pf.indexOf(".properties")); Locale loc = ResourceManager.getChoosenLocale(); if (loc.getLanguage().length() > 0) { try { Utils.manageProperties(eps, getCurrentConfigFolder(), locStrOrig + "_" + loc.getLanguage() + ".properties"); } catch (Exception ex) { } if (loc.getCountry().length() > 0) { try { Utils.manageProperties(eps, getCurrentConfigFolder(), locStrOrig + "_" + loc.getLanguage() + "_" + loc.getCountry() + ".properties"); } catch (Exception ex) { } if (loc.getVariant().length() > 0) { try { Utils.manageProperties(eps, getCurrentConfigFolder(), locStrOrig + "_" + loc.getLanguage() + "_" + loc.getCountry() + "_" + loc.getVariant() + ".properties"); } catch (Exception ex) { } } } } propertyFiles.add(eps); } } } } public String getLanguageDependentString(String nm) { String str = null; Iterator it = propertyFiles.iterator(); while (it.hasNext()) { Object o = it.next(); if (o instanceof ResourceBundle) { try { ResourceBundle bundle = (ResourceBundle)o; str = bundle.getString(nm); if (str != null) break; } catch (Exception mre) { } } else { Properties eps=(Properties)o; str=eps.getProperty(nm); } } return str; } protected String getCurrentConfigFolder() { String currentConfig = JaWEConstants.JAWE_USER_HOME; String cch = System.getProperty(JaWEConstants.JAWE_CURRENT_CONFIG_HOME); if (cch != null) { currentConfig = cch; } return currentConfig; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -