當前位置: 首頁>>代碼示例>>Java>>正文


Java ResourceBundleMessageSource.setFallbackToSystemLocale方法代碼示例

本文整理匯總了Java中org.springframework.context.support.ResourceBundleMessageSource.setFallbackToSystemLocale方法的典型用法代碼示例。如果您正苦於以下問題:Java ResourceBundleMessageSource.setFallbackToSystemLocale方法的具體用法?Java ResourceBundleMessageSource.setFallbackToSystemLocale怎麽用?Java ResourceBundleMessageSource.setFallbackToSystemLocale使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.context.support.ResourceBundleMessageSource的用法示例。


在下文中一共展示了ResourceBundleMessageSource.setFallbackToSystemLocale方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: defaultMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource defaultMessageSource() {
    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;
}
 
開發者ID:xm-online,項目名稱:xm-ms-entity,代碼行數:12,代碼來源:LocaleConfiguration.java

示例2: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * @return ResourceBundleMessageSource pour les messages de l'application
 */
@Bean
public ResourceBundleMessageSource messageSource() {
	ResourceBundleMessageSource resourceBundleMessageSource = new ResourceBundleMessageSource();
	resourceBundleMessageSource.setBasenames(
			"i18n/messages",
			"i18n/backoffice/backoffice-messages",
			"i18n/backoffice/nomenclature-messages",
			"i18n/candidat/candidat-messages");
	resourceBundleMessageSource.setFallbackToSystemLocale(false);
	return resourceBundleMessageSource;
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:15,代碼來源:SpringConfig.java

示例3: createMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * Create a MessageSource for the given basename,
 * to be used as MessageSource for the corresponding theme.
 * <p>Default implementation creates a ResourceBundleMessageSource.
 * for the given basename. A subclass could create a specifically
 * configured ReloadableResourceBundleMessageSource, for example.
 * @param basename the basename to create a MessageSource for
 * @return the MessageSource
 * @see org.springframework.context.support.ResourceBundleMessageSource
 * @see org.springframework.context.support.ReloadableResourceBundleMessageSource
 */
protected MessageSource createMessageSource(String basename) {
	ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
	messageSource.setBasename(basename);
	if (this.defaultEncoding != null) {
		messageSource.setDefaultEncoding(this.defaultEncoding);
	}
	if (this.fallbackToSystemLocale != null) {
		messageSource.setFallbackToSystemLocale(this.fallbackToSystemLocale);
	}
	if (this.beanClassLoader != null) {
		messageSource.setBeanClassLoader(this.beanClassLoader);
	}
	return messageSource;
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:26,代碼來源:ResourceBundleThemeSource.java

示例4: createValidator

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
public static Validator createValidator() {
  LocaleContextHolder.setLocale(Locale.ENGLISH);
  ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
  messageSource.setFallbackToSystemLocale(false);
  messageSource.setBasenames("validation");
  messageSource.setDefaultEncoding("utf8");

  LocalValidatorFactoryBean localValidator = new LocalValidatorFactoryBean();
  localValidator.setValidationMessageSource(messageSource);
  localValidator.afterPropertiesSet();
  return localValidator;
}
 
開發者ID:puncha,項目名稱:petclinic,代碼行數:13,代碼來源:TestUtil.java

示例5: searchOperations

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean public ResourceBundleMessageSource searchOperations() {
    ResourceBundleMessageSource bundle = new ResourceBundleMessageSource();
    bundle.setFallbackToSystemLocale(false);
    bundle.setBasenames("com/jongsoft/harvester/service/operations");
    bundle.setBundleClassLoader(ServiceConfiguration.class.getClassLoader());
    return bundle;
}
 
開發者ID:gjong,項目名稱:web-harvester,代碼行數:8,代碼來源:ServiceConfiguration.java

示例6: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource messageSource() {
	ResourceBundleMessageSource result = new ResourceBundleMessageSource();
	result.setBasename("messages");
	result.setFallbackToSystemLocale(false);
	return result;
}
 
開發者ID:coinblesk,項目名稱:coinblesk-server,代碼行數:8,代碼來源:BeanConfig.java

示例7: mailSetup

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Before
public void mailSetup() {
  configuration = new Configuration(Configuration.VERSION_2_3_21);
  configuration.setDefaultEncoding("UTF-8");
  configuration.setTemplateLoader(new ClassTemplateLoader(MailComposer.class, "/mail"));

  //keep config same as application.yml and WebConfiguration.java
  messageSource = new ResourceBundleMessageSource();
  messageSource.setBasename("i18n/messages");
  messageSource.setDefaultEncoding("UTF-8");
  messageSource.setFallbackToSystemLocale(false);
}
 
開發者ID:kaif-open,項目名稱:kaif,代碼行數:13,代碼來源:MailTestCases.java

示例8: smsMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ResourceBundleMessageSource smsMessageSource()
{
	final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
	messageSource.setFallbackToSystemLocale(false);
	messageSource.setBasename("templates.sms.messages");
	return messageSource;
}
 
開發者ID:yonadev,項目名稱:yona-server,代碼行數:9,代碼來源:ThymeleafConfiguration.java

示例9: emailMessageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ResourceBundleMessageSource emailMessageSource()
{
	final ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
	messageSource.setFallbackToSystemLocale(false);
	messageSource.setBasename("templates.email.messages");
	return messageSource;
}
 
開發者ID:yonadev,項目名稱:yona-server,代碼行數:9,代碼來源:ThymeleafConfiguration.java

示例10: buildSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
private ResourceBundleMessageSource buildSource(String basename, ClassLoader classLoader) {
    ResourceBundleMessageSource source = new ResourceBundleMessageSource();
    source.setDefaultEncoding(StandardCharsets.UTF_8.name());
    source.setFallbackToSystemLocale(false);
    source.setBasename(basename);

    if (classLoader == null) {
        classLoader = LocalizationServiceImpl.class.getClassLoader();
    }
    source.setBundleClassLoader(classLoader);

    return source;
}
 
開發者ID:Evolveum,項目名稱:midpoint,代碼行數:14,代碼來源:LocalizationServiceImpl.java

示例11: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource messageSource() {
    ResourceBundleMessageSource ms = new ResourceBundleMessageSource();
    ms.setDefaultEncoding("UTF-8");
    ms.setFallbackToSystemLocale(false);
    ms.setBasename("i18n/messages");
    return ms;
}
 
開發者ID:asaas,項目名稱:pebble-spring-translate,代碼行數:9,代碼來源:TestConfig.java

示例12: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@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;
}
 
開發者ID:alfio-event,項目名稱:alf.io,代碼行數:11,代碼來源:DataSourceConfiguration.java

示例13: messageSource

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ResourceBundleMessageSource messageSource() {
	ResourceBundleMessageSource ms = new ResourceBundleMessageSource();
	ms.setBasenames(messageSourceBasenames);
	ms.setFallbackToSystemLocale(false);
	return ms;
}
 
開發者ID:hectorlf,項目名稱:angularjs-test,代碼行數:8,代碼來源:AppConfiguration.java

示例14: SpringBundle

import org.springframework.context.support.ResourceBundleMessageSource; //導入方法依賴的package包/類
protected SpringBundle(String... baseNames) {
    source = new ResourceBundleMessageSource();
    source.setFallbackToSystemLocale(false);
    source.setBasenames(baseNames);
    source.setUseCodeAsDefaultMessage(true);
}
 
開發者ID:Talend,項目名稱:data-prep,代碼行數:7,代碼來源:SpringBundle.java


注:本文中的org.springframework.context.support.ResourceBundleMessageSource.setFallbackToSystemLocale方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。