/**
* Use for Spark Internationalization.
*
* @author Derek DeMoro
*/
public class Res {
// 属性资源包
private static PropertyResourceBundle prb;
private Res() {
}
static ClassLoader cl = Res.class.getClassLoader();
static {
prb = (PropertyResourceBundle)ResourceBundle.getBundle("i18n/spark_i18n");
}
public static String getString(String propertyName) {
try {
String pluginString = PluginRes.getI18nRes(propertyName);
return pluginString != null ? pluginString : prb.getString(propertyName);
}
catch (Exception e) {
Log.error(e);
return propertyName;
}
}
public static String getString(String propertyName, Object... obj) {
String pluginString = PluginRes.getI18nRes(propertyName);
String str = pluginString != null ? pluginString : prb.getString(propertyName);
if (str == null) {
return propertyName;
}
return MessageFormat.format(str, obj);
}
//
public static PropertyResourceBundle getBundle() {
return prb;
}
}
openfire+Spark二次开发-Res用于spark国际化
最新推荐文章于 2023-11-09 08:33:28 发布