Search in sources :

Example 1 with ResourceBundleMessageSource

use of org.springframework.context.support.ResourceBundleMessageSource in project libresonic by Libresonic.

the class LibresonicThemeSource method createMessageSource.

@Override
protected MessageSource createMessageSource(String basename) {
    ResourceBundleMessageSource messageSource = (ResourceBundleMessageSource) super.createMessageSource(basename);
    // Create parent theme recursively.
    for (Theme theme : settingsService.getAvailableThemes()) {
        if (basename.equals(basenamePrefix + theme.getId()) && theme.getParent() != null) {
            String parent = basenamePrefix + theme.getParent();
            messageSource.setParentMessageSource(createMessageSource(parent));
            break;
        }
    }
    return messageSource;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) Theme(org.libresonic.player.domain.Theme)

Example 2 with ResourceBundleMessageSource

use of org.springframework.context.support.ResourceBundleMessageSource in project alf.io by alfio-event.

the class DataSourceConfiguration method messageSource.

@Bean
public MessageSource messageSource() {
    ResourceBundleMessageSource source = new ResourceBundleMessageSource();
    source.setBasenames("alfio.i18n.public", "alfio.i18n.admin");
    // since we have all the english translations in the default file, we don't need
    // the fallback to the system locale.
    source.setFallbackToSystemLocale(false);
    source.setAlwaysUseMessageFormat(true);
    return source;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource)

Example 3 with ResourceBundleMessageSource

use of org.springframework.context.support.ResourceBundleMessageSource in project FP-PSP-SERVER by FundacionParaguaya.

the class WebMvcConfig method messageSource.

@Bean
public MessageSource messageSource() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasenames(MESSAGES_PATH);
    messageSource.setFallbackToSystemLocale(false);
    return messageSource;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean) LocalValidatorFactoryBean(org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)

Example 4 with ResourceBundleMessageSource

use of org.springframework.context.support.ResourceBundleMessageSource in project tutorials by eugenp.

the class ClientWebConfig method messageSource.

@Bean
@Description("Spring message resolver")
public MessageSource messageSource() {
    final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasename("messages");
    return messageSource;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) Description(org.springframework.context.annotation.Description) Bean(org.springframework.context.annotation.Bean)

Example 5 with ResourceBundleMessageSource

use of org.springframework.context.support.ResourceBundleMessageSource in project motech by motech.

the class PasswordRecoveryServiceTest method prepareMessageSource.

private void prepareMessageSource() {
    messageSource = new ResourceBundleMessageSource();
    messageSource.setBasename("messages/messages");
    messageSource.setUseCodeAsDefaultMessage(true);
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource)

Aggregations

ResourceBundleMessageSource (org.springframework.context.support.ResourceBundleMessageSource)40 Bean (org.springframework.context.annotation.Bean)19 ResourceBundleMessageInterpolator (org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator)6 PlatformResourceBundleLocator (org.hibernate.validator.resourceloading.PlatformResourceBundleLocator)6 ValidatorFactory (javax.validation.ValidatorFactory)5 Before (org.junit.Before)5 LocalValidatorFactoryBean (org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)3 HashSet (java.util.HashSet)2 MessageFormatFactory (org.molgenis.i18n.format.MessageFormatFactory)2 TestAllPropertiesMessageSource (org.molgenis.i18n.test.exception.TestAllPropertiesMessageSource)2 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)2 Description (org.springframework.context.annotation.Description)2 BeforeClass (org.testng.annotations.BeforeClass)2 IdentifiableTestEntity (ca.corefacility.bioinformatics.irida.web.controller.test.unit.support.IdentifiableTestEntity)1 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)1 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 IOException (java.io.IOException)1 Method (java.lang.reflect.Method)1 URL (java.net.URL)1