Commit 3377f1ba authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Update LocaleUtils to retrieve ResourceBundles for an individual plugin.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@3953 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0f32fe9f
......@@ -428,7 +428,7 @@ public class LocaleUtils {
final XMPPServer xmppServer = XMPPServer.getInstance();
PluginManager pluginManager = xmppServer.getPluginManager();
Plugin plugin = pluginManager.getPlugin(pluginName);
if (plugin == null){
if (plugin == null) {
throw new NullPointerException("Plugin could not be located.");
}
......@@ -437,6 +437,30 @@ public class LocaleUtils {
return getLocalizedString(key, locale, arguments, bundle);
}
/**
* Retrieve the <code>ResourceBundle</code> that is used with this plugin.
*
* @param pluginName the name of the plugin.
* @return the ResourceBundle used with this plugin.
* @throws Exception thrown if an exception occurs.
*/
public static ResourceBundle getPluginResourceBundle(String pluginName) throws Exception {
final Locale locale = JiveGlobals.getLocale();
String i18nFile = pluginName + "_i18n";
// Retrieve classloader from pluginName.
final XMPPServer xmppServer = XMPPServer.getInstance();
PluginManager pluginManager = xmppServer.getPluginManager();
Plugin plugin = pluginManager.getPlugin(pluginName);
if (plugin == null) {
throw new NullPointerException("Plugin could not be located.");
}
ClassLoader pluginClassLoader = pluginManager.getPluginClassloader(plugin).getClassLoader();
return ResourceBundle.getBundle(i18nFile, locale, pluginClassLoader);
}
/**
* Returns an internationalized string loaded from a resource bundle using
* the passed in Locale substituting the passed in arguments. Substitution
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment