use of org.springframework.context.support.ResourceBundleMessageSource in project connectors-workspace-one by vmware.
the class ConnectorTextAccessorTest method messageSource.
@Bean
public MessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setFallbackToSystemLocale(false);
messageSource.setBasename(BASE_NAME);
return messageSource;
}
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);
}
use of org.springframework.context.support.ResourceBundleMessageSource in project spring-boot-quick by vector4wang.
the class ResourceBundleConfig method messageSource.
@Bean
public ResourceBundleMessageSource messageSource() {
Locale.setDefault(Locale.CHINESE);
ResourceBundleMessageSource source = new ResourceBundleMessageSource();
/**
* 也可以在application.properties中添加配置
* spring.messages.basename=i18n/messages
* spring.messages.encoding=UTF-8
*/
// name of the resource bundle
source.setBasenames("i18n/messages");
source.setUseCodeAsDefaultMessage(true);
source.setDefaultEncoding("UTF-8");
return source;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project thymeleaf by thymeleaf.
the class SpringMailConfig method emailMessageSource.
/*
* Message externalization/internationalization for emails.
*
* NOTE we are avoiding the use of the name 'messageSource' for this bean because that
* would make the MessageSource defined in SpringWebConfig (and made available for the
* web-side template engine) delegate to this one, and thus effectively merge email
* messages into web messages and make both types available at the web side, which could
* bring undesired collisions.
*
* NOTE also that given we want this specific message source to be used by our
* SpringTemplateEngines for emails (and not by the web one), we will set it explicitly
* into each of the TemplateEngine objects with 'setTemplateEngineMessageSource(...)'
*/
@Bean
public ResourceBundleMessageSource emailMessageSource() {
final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("mail/MailMessages");
return messageSource;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project thymeleaf by thymeleaf.
the class SpringWebConfig method messageSource.
/*
* Message externalization/internationalization
*/
@Bean
public ResourceBundleMessageSource messageSource() {
final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("Messages");
return messageSource;
}
Aggregations