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);
}
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;
}
}
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;
}
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));
}
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);
}
}
}
Aggregations