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;
}
use of org.springframework.context.support.ResourceBundleMessageSource in project molgenis by molgenis.
the class RestControllerV2Test method beforeClass.
@BeforeClass
public void beforeClass() {
ResourceBundleMessageSource validationMessages = new ResourceBundleMessageSource();
validationMessages.addBasenames("org.hibernate.validator.ValidationMessages");
TestAllPropertiesMessageSource messageSource = new TestAllPropertiesMessageSource(new MessageFormatFactory());
messageSource.addMolgenisNamespaces("data", "web");
messageSource.setParentMessageSource(validationMessages);
MessageSourceHolder.setMessageSource(messageSource);
}
use of org.springframework.context.support.ResourceBundleMessageSource in project molgenis by molgenis.
the class RestControllerTest method beforeClass.
@BeforeClass
public void beforeClass() {
ResourceBundleMessageSource validationMessages = new ResourceBundleMessageSource();
validationMessages.addBasenames("org.hibernate.validator.ValidationMessages");
TestAllPropertiesMessageSource messageSource = new TestAllPropertiesMessageSource(new MessageFormatFactory());
messageSource.addMolgenisNamespaces("data", "web");
messageSource.setParentMessageSource(validationMessages);
MessageSourceHolder.setMessageSource(messageSource);
}
use of org.springframework.context.support.ResourceBundleMessageSource in project molgenis by molgenis.
the class SpringExceptionHandlerTest method beforeClass.
@BeforeClass
public void beforeClass() {
AllPropertiesMessageSource molgenisLocalizationMessages = new AllPropertiesMessageSource();
molgenisLocalizationMessages.addMolgenisNamespaces("web");
ResourceBundleMessageSource hibernateValidationMessages = new ResourceBundleMessageSource();
hibernateValidationMessages.addBasenames("org.hibernate.validator.ValidationMessages");
molgenisLocalizationMessages.setParentMessageSource(hibernateValidationMessages);
MessageSourceHolder.setMessageSource(molgenisLocalizationMessages);
globalError = new ObjectError("entityCollectionRequestV2", new String[] { "TwoFieldsSet" }, new Object[] { 1 }, "must have two fields set");
fieldError = new FieldError("entityCollectionRequestV2", "num", -10, false, new String[] { "Min.entityCollectionRequestV2.num", "Min.num", "Min.int", "Min" }, new Object[] { new DefaultMessageSourceResolvable(new String[] { "entityCollectionRequestV2.num", "num" }, null, "num"), 0 }, "must be greater than or equal to 0");
}
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;
}
Aggregations