use of org.springframework.context.support.ResourceBundleMessageSource in project id-authentication by mosip.
the class IDAuthExceptionHandlerTest method before.
@Before
public void before() {
ResourceBundleMessageSource source = new ResourceBundleMessageSource();
source.setBasename("errormessages");
ReflectionTestUtils.setField(handler, "servletRequest", servletRequest);
}
use of org.springframework.context.support.ResourceBundleMessageSource in project ieasy-server by baayso.
the class ErrorFactory method initMessageSource.
/**
* 设置国际化资源信息
*/
public static void initMessageSource(List<String> isvModules) {
HashSet<String> baseNamesSet = new HashSet<String>();
baseNamesSet.add(I18N_OPEN_ERROR);
if (!isvModules.isEmpty()) {
baseNamesSet.addAll(isvModules);
}
String[] totalBaseNames = baseNamesSet.toArray(new String[0]);
if (logger.isInfoEnabled()) {
logger.info("加载错误码国际化资源:{}", StringUtils.arrayToCommaDelimitedString(totalBaseNames));
}
ResourceBundleMessageSource bundleMessageSource = new ResourceBundleMessageSource();
bundleMessageSource.setBasenames(totalBaseNames);
MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(bundleMessageSource);
setErrorMessageSourceAccessor(messageSourceAccessor);
}
use of org.springframework.context.support.ResourceBundleMessageSource in project PublicCMS by sanluan.
the class ApplicationConfig method messageSource.
/**
* 国际化处理
*
* @param menuMessageComponent
*
* @return message source
*/
@Bean
public MessageSource messageSource(MenuMessageComponent menuMessageComponent) {
ResourceBundleMessageSource bean = new ResourceBundleMessageSource();
bean.setBasenames(StringUtils.split(env.getProperty("cms.language"), CommonConstants.COMMA_DELIMITED));
bean.setCacheSeconds(300);
bean.setUseCodeAsDefaultMessage(true);
bean.setParentMessageSource(menuMessageComponent);
return bean;
}
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 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;
}
Aggregations