All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.apexes.commons.i18n.JdkI18nResource Maven / Gradle / Ivy

There is a newer version: 2.1.6
Show newest version
package net.apexes.commons.i18n;

import java.util.Enumeration;
import java.util.Locale;
import java.util.ResourceBundle;

/**
 * @author hedyn
 */
public class JdkI18nResource implements I18nResource {

    private final ResourceBundle resourceBundle;

    public JdkI18nResource(String bundleName, Locale locale) {
        if (locale == null) {
            this.resourceBundle = ResourceBundle.getBundle(bundleName);
        } else {
            this.resourceBundle = ResourceBundle.getBundle(bundleName, locale);
        }
    }

    @Override
    public Locale getLocale() {
        return resourceBundle.getLocale();
    }

    @Override
    public Enumeration getKeys() {
        return resourceBundle.getKeys();
    }

    @Override
    public boolean containsKey(String key) {
        return resourceBundle.containsKey(key);
    }

    @Override
    public String getString(String key) {
        return resourceBundle.getString(key);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy