Search in sources :

Example 66 with ResourceBundleMessageSource

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

the class SpringWebConfig method messageSource.

/*
     *  Message externalization/internationalization
     */
@Bean
public ResourceBundleMessageSource messageSource() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasename("Messages");
    return messageSource;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean)

Example 67 with ResourceBundleMessageSource

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

the class ThingsboardMessageConfiguration method messageSource.

@Bean
@Primary
public MessageSource messageSource() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasename("i18n/messages");
    messageSource.setDefaultEncoding("UTF-8");
    return messageSource;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) Primary(org.springframework.context.annotation.Primary) Bean(org.springframework.context.annotation.Bean)

Example 68 with ResourceBundleMessageSource

use of org.springframework.context.support.ResourceBundleMessageSource in project probate-back-office by hmcts.

the class ApplicationConfiguration method resourceMessageSource.

@Bean
public ResourceBundleMessageSource resourceMessageSource() {
    ResourceBundleMessageSource source = new ResourceBundleMessageSource();
    source.setBasename("ResourceMessages");
    return source;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean)

Example 69 with ResourceBundleMessageSource

use of org.springframework.context.support.ResourceBundleMessageSource in project SpringMVCSampleProject by ramazansakin.

the class AppConfig method messageSource.

/*public void configureViewResolvers(ViewResolverRegistry registry) {
		XmlViewResolver xmlViewResolver = new XmlViewResolver();
		xmlViewResolver.setLocation(resourceLoader.getResource("WEB-INF/jasper-views.xml"));
		xmlViewResolver.setOrder(0);
		registry.viewResolver(xmlViewResolver);
	}*/
@Bean
public MessageSource messageSource() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasename("messages");
    return messageSource;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean)

Example 70 with ResourceBundleMessageSource

use of org.springframework.context.support.ResourceBundleMessageSource in project xm-ms-entity by xm-online.

the class LocaleConfiguration method messageSource.

@Bean
public MessageSource messageSource() {
    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
    messageSource.setBasenames("messages", "i18n/messages");
    messageSource.setDefaultEncoding(Charset.forName("UTF-8").name());
    messageSource.setFallbackToSystemLocale(true);
    messageSource.setCacheSeconds(-1);
    messageSource.setAlwaysUseMessageFormat(false);
    messageSource.setUseCodeAsDefaultMessage(true);
    return messageSource;
}
Also used : ResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource) Bean(org.springframework.context.annotation.Bean)

Aggregations

ResourceBundleMessageSource (org.springframework.context.support.ResourceBundleMessageSource)179 Bean (org.springframework.context.annotation.Bean)99 Before (org.junit.Before)16 MessageSourceAccessor (org.springframework.context.support.MessageSourceAccessor)13 LocalValidatorFactoryBean (org.springframework.validation.beanvalidation.LocalValidatorFactoryBean)9 ValidatorFactory (javax.validation.ValidatorFactory)6 ResourceBundleMessageInterpolator (org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator)6 PlatformResourceBundleLocator (org.hibernate.validator.resourceloading.PlatformResourceBundleLocator)6 Test (org.junit.Test)6 Test (org.junit.jupiter.api.Test)6 IOException (java.io.IOException)5 List (java.util.List)5 Locale (java.util.Locale)5 ReaderFactoryByMap (net.n2oapp.framework.config.selective.reader.ReaderFactoryByMap)5 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)5 MessageSource (org.springframework.context.MessageSource)5 ArrayList (java.util.ArrayList)4 N2oApplicationBuilder (net.n2oapp.framework.config.N2oApplicationBuilder)4 N2oEnvironment (net.n2oapp.framework.config.compile.pipeline.N2oEnvironment)4 PersisterFactoryByMap (net.n2oapp.framework.config.selective.persister.PersisterFactoryByMap)4