Search in sources :

Example 6 with ResourceBundle

use of java.util.ResourceBundle in project cryptomator by cryptomator.

the class LocalizationTest method testStringFormatIsValid.

@Test
public void testStringFormatIsValid() throws IOException {
    ResourceBundle ref = loadLanguage(RESOURCE_FOLDER_PATH + REF_FILE_NAME);
    boolean allGood = true;
    for (String langFileName : LANG_FILE_NAMES) {
        ResourceBundle lang = loadLanguage(RESOURCE_FOLDER_PATH + langFileName);
        allGood &= allStringFormatSpecifiersMatchReferenceLanguage(ref, lang, langFileName);
    }
    Assert.assertTrue(allGood);
}
Also used : PropertyResourceBundle(java.util.PropertyResourceBundle) ResourceBundle(java.util.ResourceBundle) Test(org.junit.Test)

Example 7 with ResourceBundle

use of java.util.ResourceBundle in project checkstyle by checkstyle.

the class LocalizedMessage method getBundle.

/**
     * Find a ResourceBundle for a given bundle name. Uses the classloader
     * of the class emitting this message, to be sure to get the correct
     * bundle.
     * @param bundleName the bundle name
     * @return a ResourceBundle
     */
private ResourceBundle getBundle(String bundleName) {
    synchronized (BUNDLE_CACHE) {
        ResourceBundle resourceBundle = BUNDLE_CACHE.get(bundleName);
        if (resourceBundle == null) {
            resourceBundle = ResourceBundle.getBundle(bundleName, sLocale, sourceClass.getClassLoader(), new Utf8Control());
            BUNDLE_CACHE.put(bundleName, resourceBundle);
        }
        return resourceBundle;
    }
}
Also used : PropertyResourceBundle(java.util.PropertyResourceBundle) ResourceBundle(java.util.ResourceBundle)

Example 8 with ResourceBundle

use of java.util.ResourceBundle in project cryptomator by cryptomator.

the class AbstractFXMLViewController method createFxmlLoader.

/**
	 * Creates a FXML loader used in {@link #loadFxml()}. This method can be overwritten for further loader customization.
	 * 
	 * @return Configured loader ready to load.
	 */
protected FXMLLoader createFxmlLoader() {
    final URL fxmlUrl = getFxmlResourceUrl();
    final ResourceBundle rb = getFxmlResourceBundle();
    final FXMLLoader loader = new FXMLLoader(fxmlUrl, rb);
    loader.setController(this);
    return loader;
}
Also used : ResourceBundle(java.util.ResourceBundle) FXMLLoader(javafx.fxml.FXMLLoader) URL(java.net.URL)

Example 9 with ResourceBundle

use of java.util.ResourceBundle in project cucumber-jvm by cucumber.

the class LoadCucumberNeedleResourceBundleTest method shouldReturnEmptyResourceBundleWhenResourceDoesNotExist.

@Test
public void shouldReturnEmptyResourceBundleWhenResourceDoesNotExist() throws Exception {
    final ResourceBundle resourceBundle = function.apply("does-not-exist");
    assertNotNull(resourceBundle);
    assertThat(resourceBundle, is(EMPTY_RESOURCE_BUNDLE));
}
Also used : ResourceBundle(java.util.ResourceBundle) Test(org.junit.Test)

Example 10 with ResourceBundle

use of java.util.ResourceBundle in project qi4j-sdk by Qi4j.

the class RequestReaderDelegator method init.

public void init(@Service Iterable<ServiceReference<RequestReader>> requestReaderReferences) throws InitializationException {
    Logger logger = LoggerFactory.getLogger(getClass());
    // Add custom readers first
    for (ServiceReference<RequestReader> requestReader : requestReaderReferences) {
        if (!requestReader.identity().equals("requestreaderdelegator")) {
            logger.info("Registered request reader:" + requestReader.identity());
            registerRequestReader(requestReader.get());
        }
    }
    // Add defaults
    ResourceBundle defaultRequestReaders = ResourceBundle.getBundle("org.qi4j.library.rest.server.rest-server");
    String requestReaderClasses = defaultRequestReaders.getString("requestreaders");
    logger.info("Using request readers:" + requestReaderClasses);
    for (String className : requestReaderClasses.split(",")) {
        try {
            Class readerClass = module.classLoader().loadClass(className.trim());
            RequestReader writer = (RequestReader) module.newObject(readerClass);
            registerRequestReader(writer);
        } catch (ClassNotFoundException e) {
            logger.warn("Could not register request reader " + className, e);
        }
    }
}
Also used : RequestReader(org.qi4j.library.rest.server.spi.RequestReader) ResourceBundle(java.util.ResourceBundle) Logger(org.slf4j.Logger)

Aggregations

ResourceBundle (java.util.ResourceBundle)605 Locale (java.util.Locale)80 MissingResourceException (java.util.MissingResourceException)80 HashMap (java.util.HashMap)41 ArrayList (java.util.ArrayList)36 ActionMessage (org.apache.struts.action.ActionMessage)29 Test (org.junit.Test)29 File (java.io.File)27 IOException (java.io.IOException)27 Enumeration (java.util.Enumeration)24 PropertyResourceBundle (java.util.PropertyResourceBundle)22 Preferences (java.util.prefs.Preferences)20 URL (java.net.URL)19 Map (java.util.Map)19 HashSet (java.util.HashSet)17 Set (java.util.Set)16 Iterator (java.util.Iterator)15 ListResourceBundle (java.util.ListResourceBundle)14 Engine (jgnash.engine.Engine)14 SSOException (com.iplanet.sso.SSOException)13