common/src/main/java/com/kakoo/foundation/common/resource/bundle/ResourceBundleManager.java
/**
     * Lookup the given key to determine in which bundle it is located.
     *
     * @param key Key to lookup.
     * @return If found, the resource bundle base name.
     * @throws ResourceBundleManagerException Thrown in case no resource bundle is registered.
     * @throws ResourceBundleException Thrown in case the given key cannot be found.
     */
Lookup the given key to determine in which bundle it is located.
@param key Key to lookup.
@return If found, the resource bundle base name.
@throws ResourceBundleManagerException Thrown in case no resource bundle is registered.
@throws ResourceBundleException Thrown in case the given key cannot be found.
Lookup the given key to determine in which bundle it is located . @param key Key to lookup . @return If found the resource bundle base name . @throws ResourceBundleManagerException Thrown in case no resource bundle is registered . @throws ResourceBundleException Thrown in case the given key cannot be found .
private static String lookup(final @NonNull String key, final @NonNull Locale locale)
    {
        String baseBundleName;
        if (BUNDLES.size() == 0)
        {
            throw new ResourceBundleManagerException("No resource bundle registered!");
        }
        if (!BUNDLES.containsKey(locale))
        {
            for (ResourceBundle bundle : BUNDLES.get(ResourceBundleManager.locale))
            {
                if (bundle.containsKey(key))
                {
                    baseBundleName =  bundle.getBaseBundleName();
                    if (baseBundleName != null)
                    {
                        return baseBundleName;
                    }
                }
            }
        }
        else
        {
            for (ResourceBundle bundle : BUNDLES.get(locale))
            {
                if (bundle.containsKey(key))
                {
                    return bundle.getBaseBundleName();
                }
            }
        }
        throw new ResourceBundleException(String.format("Can't register resource bundle find key: '%s'", key));
    }
private static String lookup ( final @ NonNull String key , final @ NonNull Locale locale ) { String baseBundleName ; if ( BUNDLES . size ( ) == 0 ) { throw new ResourceBundleManagerException ( "No resource bundle registered!" ) ; } if ( ! BUNDLES . containsKey ( locale ) ) { for ( ResourceBundle bundle : BUNDLES . get ( ResourceBundleManager . locale ) ) { if ( bundle . containsKey ( key ) ) { baseBundleName = bundle . getBaseBundleName ( ) ; if ( baseBundleName != null ) { return baseBundleName ; } } } } else { for ( ResourceBundle bundle : BUNDLES . get ( locale ) ) { if ( bundle . containsKey ( key ) ) { return bundle . getBaseBundleName ( ) ; } } } throw new ResourceBundleException ( String . format ( "Can't register resource bundle find key: '%s'" , key ) ) ; }
Lookup the given key to determine in which bundle it is located.
Lookup the given key to determine in which bundle it is located .
// We are looking with the default locale. // Do a lookup with the default locale.