common/src/main/java/com/kakoo/foundation/common/resource/bundle/ResourceBundleManager.java
/**
     * Retrieves the given key.
     *
     * @param baseBundleName Base bundle file name.
     * @param key Key o retrieve.
     * @param locale Locale to use.
     * @return If found, the resource bundle value.
     * @throws ResourceBundleException Thrown in case the given key cannot be found.
     */
Retrieves the given key.
@param baseBundleName Base bundle file name.
@param key Key o retrieve.
@param locale Locale to use.
@return If found, the resource bundle value.
@throws ResourceBundleException Thrown in case the given key cannot be found.
Retrieves the given key . @param baseBundleName Base bundle file name . @param key Key o retrieve . @param locale Locale to use . @return If found the resource bundle value . @throws ResourceBundleException Thrown in case the given key cannot be found .
private static String retrieve(final @NonNull String baseBundleName,  final @NonNull String key, final @NonNull Locale locale, final Object... parameters)
    {
        if (BUNDLES.get(locale) == null)
        {
            register(baseBundleName, locale);
        }
        List<ResourceBundle> list = BUNDLES.get(locale);
        if (list == null)
        {
            list = BUNDLES.get(ResourceBundleManager.locale);
            if (list == null)
            {
                throw new ResourceBundleException(String.format("Can't find resource bundle file: '%s', locale: '%s'", baseBundleName, locale));
            }
        }
        for (ResourceBundle bundle : list)
        {
            if (bundle.getBaseBundleName().equals(baseBundleName))
            {
                return MessageFormat.format(bundle.getString(key), parameters);
            }
        }
        throw new ResourceBundleException(String.format("Can't find resource bundle key: '%s'", key));
    }
private static String retrieve ( final @ NonNull String baseBundleName , final @ NonNull String key , final @ NonNull Locale locale , final Object ... parameters ) { if ( BUNDLES . get ( locale ) == null ) { register ( baseBundleName , locale ) ; } List < ResourceBundle > list = BUNDLES . get ( locale ) ; if ( list == null ) { list = BUNDLES . get ( ResourceBundleManager . locale ) ; if ( list == null ) { throw new ResourceBundleException ( String . format ( "Can't find resource bundle file: '%s', locale: '%s'" , baseBundleName , locale ) ) ; } } for ( ResourceBundle bundle : list ) { if ( bundle . getBaseBundleName ( ) . equals ( baseBundleName ) ) { return MessageFormat . format ( bundle . getString ( key ) , parameters ) ; } } throw new ResourceBundleException ( String . format ( "Can't find resource bundle key: '%s'" , key ) ) ; }
Retrieves the given key.
Retrieves the given key .
// Try to register the resource bundle in the requested locale. // Try to load it from the default locale.