use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project gocd by gocd.
the class LocalizerTest method shouldLocalizeDurations.
@Test
public void shouldLocalizeDurations() {
CurrentLocale locale = new CurrentLocale();
ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
source.setBasename("test_message");
MessageSourceAccessor accessor = new MessageSourceAccessor(source);
Localizer localizer = new Localizer(accessor, locale);
assertThat(localizer.localize(new Duration(1000)), is("1 second"));
assertThat(localizer.localize(new Duration(0)), is(""));
locale.setLocaleString(Localizer.LOCALE_KANNADA);
assertThat(localizer.localize(new Duration(1000)), is("1 second"));
}
use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project spring-thymeleaf-simplefinance by heitkergm.
the class SpringWebConfig method messageSource.
// beans for i18n
/**
* Message source.
*
* @return the message source
*/
@Bean
MessageSource messageSource() {
final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
source.setCacheSeconds(60);
source.setBasenames("classpath:messages", "classpath:ValidationMessages");
return source;
}
use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project motech by motech.
the class SwaggerGeneratorTest method setUp.
@Before
public void setUp() throws IOException {
messageSource = new ReloadableResourceBundleMessageSource();
((ReloadableResourceBundleMessageSource) messageSource).setBasename("swagger-messages");
swaggerGenerator.setSwaggerMessageSource(messageSource);
try (InputStream in = getClass().getClassLoader().getResourceAsStream("swagger.properties")) {
swaggerProperties = new Properties();
swaggerProperties.load(in);
swaggerGenerator.setSwaggerProperties(swaggerProperties);
swaggerGenerator.setAllEntities(allEntities);
}
when(allEntities.retrieveAll()).thenReturn(entities());
}
use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project irida by phac-nml.
the class IridaRestApiWebConfig method messageSource.
@Bean
public MessageSource messageSource() {
String[] resources = { "classpath:/i18n/oauth" };
ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
source.setBasenames(resources);
source.setDefaultEncoding("UTF-8");
return source;
}
use of org.springframework.context.support.ReloadableResourceBundleMessageSource in project irida by phac-nml.
the class MvcConfiguration method messageSource.
/**
* Message source for internationalization
* @return
*/
@Bean
public MessageSource messageSource() {
String[] resources = { "classpath:/i18n/demo" };
ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
source.setBasenames(resources);
source.setDefaultEncoding("UTF-8");
return source;
}
Aggregations