public static @Nonnull JSONObject getBundle(@Nonnull String baseName, @Nonnull Locale locale) throws MissingResourceException {
        String bundleKey = baseName + ":" + locale.toString();
        JSONObject bundleJSON = bundles.get(bundleKey);

        if (bundleJSON != null) {
            return bundleJSON;
        }

        ResourceBundle bundle = getBundle(baseName, locale, Jenkins.class.getClassLoader());
        if (bundle == null) {
            // Not in Jenkins core. Check the plugins.
            Jenkins jenkins = Jenkins.getInstance(); // will never return null
            if (jenkins != null) {
                for (PluginWrapper plugin : jenkins.getPluginManager().getPlugins()) {
                    bundle = getBundle(baseName, locale, plugin.classLoader);
                    if (bundle != null) {
                        break;
                    }
                }
            }
        }
        if (bundle == null) {
            throw new MissingResourceException("Can't find bundle for base name "
                    + baseName + ", locale " + locale, baseName + "_" + locale, "");
        }

        bundleJSON = toJSONObject(bundle);
        bundles.put(bundleKey, bundleJSON);

        return bundleJSON;
    }
public static @ Nonnull JSONObject getBundle ( @ Nonnull String baseName , @ Nonnull Locale locale ) throws MissingResourceException { String bundleKey = baseName + ":" + locale . toString ( ) ; JSONObject bundleJSON = bundles . get ( bundleKey ) ; if ( bundleJSON != null ) { return bundleJSON ; } ResourceBundle bundle = getBundle ( baseName , locale , Jenkins . class . getClassLoader ( ) ) ; if ( bundle == null ) { Jenkins jenkins = Jenkins . getInstance ( ) ; if ( jenkins != null ) { for ( PluginWrapper plugin : jenkins . getPluginManager ( ) . getPlugins ( ) ) { bundle = getBundle ( baseName , locale , plugin . classLoader ) ; if ( bundle != null ) { break ; } } } } if ( bundle == null ) { throw new MissingResourceException ( "Can't find bundle for base name " + baseName + ", locale " + locale , baseName + "_" + locale , "" ) ; } bundleJSON = toJSONObject ( bundle ) ; bundles . put ( bundleKey , bundleJSON ) ; return bundleJSON ; }
Get a bundle JSON using the supplied Locale.
@param baseName The bundle base name.
@param locale The Locale.
@return The bundle JSON.
@throws MissingResourceException Missing resource bundle.