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


Java ReloadableResourceBundleMessageSource.setFallbackToSystemLocale方法代碼示例

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


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

示例1: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean(name = "messageSource")
public MessageSource messageSource() {
    // MessageSource configuration for localized messages.
    final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();

    source.setBasenames("classpath:/i18n/messages", "classpath:ValidationMessages");
    source.setUseCodeAsDefaultMessage(true);
    source.setFallbackToSystemLocale(false);
    source.setDefaultEncoding(StandardCharsets.ISO_8859_1.name());

    if (runtimeEnvironmentUtil.isDevelopmentEnvironment()) {
        // Check for updates on every refresh, otherwise cache forever
        source.setCacheSeconds(1);
    }

    return source;
}
 
開發者ID:suomenriistakeskus,項目名稱:oma-riista-web,代碼行數:18,代碼來源:LocalizationConfig.java

示例2: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
    ReloadableResourceBundleMessageSource resource = new ReloadableResourceBundleMessageSource();
    resource.setBasenames("/WEB-INF/locales/messages");
    resource.setDefaultEncoding("UTF-8");
    resource.setFallbackToSystemLocale(Boolean.TRUE);
    return resource;
}
 
開發者ID:PacktPublishing,項目名稱:Spring-Security-Third-Edition,代碼行數:9,代碼來源:WebMvcConfig.java

示例3: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ReloadableResourceBundleMessageSource messageSource() {
	ReloadableResourceBundleMessageSource messageResource = new ReloadableResourceBundleMessageSource();
	messageResource.setBasenames("WEB-INF/i18n/messages");
	messageResource.setFallbackToSystemLocale(false);
	return messageResource;
}
 
開發者ID:Apress,項目名稱:introducing-spring-framework,代碼行數:8,代碼來源:WebConfig.java

示例4: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Primary
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource() { // @todo not working
    ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();
    messageBundle.setBasename("classpath:messages");
    messageBundle.addBasenames("classpath:messages", "classpath:validation");
    messageBundle.setUseCodeAsDefaultMessage(true);
    messageBundle.setDefaultEncoding("UTF-8");
    messageBundle.setFallbackToSystemLocale(true);

    return messageBundle;
}
 
開發者ID:bulktrade,項目名稱:SMSC,代碼行數:13,代碼來源:AppConfiguration.java

示例5: ResourceBundleManager

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * default constructor
 */
private ResourceBundleManager() {
    basenames.add("classpath:com/communote/server/core/i18n/messages");
    basenames.add("classpath:com/communote/server/core/i18n/administration-messages");
    basenames.add("classpath:com/communote/server/core/i18n/installer-messages");
    messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setBasenames(basenames.toArray(new String[basenames.size()]));
    messageSource.setFallbackToSystemLocale(false);
}
 
開發者ID:Communote,項目名稱:communote-server,代碼行數:13,代碼來源:ResourceBundleManager.java

示例6: getMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * Gets the reloadable resource bundle message source.
 *
 * @return the reloadable resource bundle message source
 */
@Bean(name = "messageSource")
public MessageSource getMessageSource() {
  logger.debug("Instantiated reloadableResourceBundleMessageSource");
  ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
  source.setBasename("/WEB-INF/messages");
  source.setCacheSeconds(1);
  source.setFallbackToSystemLocale(false);
  return source;
}
 
開發者ID:psi-probe,項目名稱:psi-probe,代碼行數:15,代碼來源:ProbeConfig.java

示例7: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * This bean tells the application which message bundle to use.
 * 
 * @return The message bundle source
 */
@Bean(name = "messageSource")
public ReloadableResourceBundleMessageSource messageSource()
{
	ReloadableResourceBundleMessageSource messageBundle = new ReloadableResourceBundleMessageSource();

	messageBundle.setFallbackToSystemLocale(false);
	messageBundle.setBasename("classpath:messages/messages");
	messageBundle.setDefaultEncoding("UTF-8");

	return messageBundle;
}
 
開發者ID:yonadev,項目名稱:yona-server,代碼行數:17,代碼來源:CoreConfiguration.java

示例8: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource messageSource() {
	ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
	source.setBasename("classpath:/io/lavagna/i18n/messages");
	source.setUseCodeAsDefaultMessage(true);
	source.setFallbackToSystemLocale(false);
	return source;
}
 
開發者ID:digitalfondue,項目名稱:lavagna,代碼行數:9,代碼來源:PersistenceAndServiceConfig.java

示例9: reloadableResourceBundleMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource() {
    ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource();
    //TODO: Move that values to properties
    source.setBasenames("/WEB-INF/locale/imcms", "/WEB-INF/locale/image_archive");
    source.setFallbackToSystemLocale(false);
    source.setUseCodeAsDefaultMessage(true);
    return source;
}
 
開發者ID:imCodePartnerAB,項目名稱:imcms,代碼行數:10,代碼來源:ApplicationConfig.java

示例10: messageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * Resolves localized messages*.properties and application.properties files in the application to allow for internationalization. 
    * The messages*.properties files translate Roo generated messages which are part of the admin interface, the application.properties
    * resource bundle localizes all application specific messages such as entity names and menu items.
 */
public @Bean ReloadableResourceBundleMessageSource messageSource () {
	final ReloadableResourceBundleMessageSource source = new ReloadableResourceBundleMessageSource ();
	
	if (!hasDojoProduction) {
		source.setCacheSeconds (0);
	}
	
	source.setBasenames ("WEB-INF/i18n/messages");
	source.setFallbackToSystemLocale (false);
	
	return source;
}
 
開發者ID:CDS-INSPIRE,項目名稱:InSpider,代碼行數:18,代碼來源:AdminWebMvcConfig.java

示例11: apiMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
@Bean
public MessageSource apiMessageSource() {
    ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setBasenames("classpath:message/restfulapi");
    messageSource.setFallbackToSystemLocale(false);
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setCacheSeconds(3600);
    return messageSource;

}
 
開發者ID:CeON,項目名稱:saos,代碼行數:11,代碼來源:ApiConfiguration.java

示例12: createDefaultMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
private MessageSource createDefaultMessageSource() {

        ReloadableResourceBundleMessageSource messages = new ReloadableResourceBundleMessageSource();
        messages.setBasename(DEFAULT_MESSAGES_BASENAME);
        messages.setDefaultEncoding("UTF-8");
        messages.setFallbackToSystemLocale(false);

        return messages;
    }
 
開發者ID:jirutka,項目名稱:spring-rest-exception-handler,代碼行數:10,代碼來源:RestHandlerExceptionResolverBuilder.java

示例13: initMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
private static MessageSource initMessageSource() {
    final ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
    messageSource.setCacheSeconds(5);
    messageSource.setDefaultEncoding("UTF-8");
    messageSource.setFallbackToSystemLocale(true);
    messageSource.setUseCodeAsDefaultMessage(false);
    messageSource.setBasename("classpath:messages");
    return messageSource;
}
 
開發者ID:trimou,項目名稱:trimou,代碼行數:10,代碼來源:SpringMessageSourceHelperTest.java

示例14: configureMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * Initiates the message resolver.
 *
 * @return a message source.
 */
@Bean(name = "messageSource")
public MessageSource configureMessageSource() {
    ReloadableResourceBundleMessageSource messageSource =
            new ReloadableResourceBundleMessageSource();
    messageSource.setBasenames(MESSAGE_SOURCE, MESSAGE_SOURCE_OVAL,
            MESSAGE_SOURCE_SPRING_SECURITY);
    messageSource.setCacheSeconds(MESSAGE_CACHE);
    messageSource.setFallbackToSystemLocale(false);
    // Make sure Apostrophs must always be doubled..
    messageSource.setAlwaysUseMessageFormat(true);
    // This persister doubles Apostoph
    messageSource.setPropertiesPersister(new RecursivePropertiesPersister(
            new ApostropheEscapingPropertiesPersister()));
    final Class<?>[] classes = URL.class.getDeclaredClasses();
    final UrlDefinitionsToMessages urlDefinitions =
            new UrlDefinitionsToMessages(classes);
    urlDefinitions.addParamGroupAsMessages();
    urlDefinitions.addParamsAsMessages();
    urlDefinitions.addUrlsAsMessagesWithPositionedParameters();
    urlDefinitions.addUrlsAsMessagesWithNamedParameters();
    Properties staticMessages = urlDefinitions.getMessages();
    final EntityPropertiesToMessages epm =
            new EntityPropertiesToMessages("de.ppi.samples.fuwesta.model");
    staticMessages.putAll(epm.getProperties());
    messageSource.setCommonMessages(staticMessages);
    return messageSource;
}
 
開發者ID:opensource21,項目名稱:fuwesta,代碼行數:33,代碼來源:WebMvcConfig.java

示例15: configureMessageSource

import org.springframework.context.support.ReloadableResourceBundleMessageSource; //導入方法依賴的package包/類
/**
 * Initiates the message resolver.
 * 
 * @return a message source.
 */
@Bean(name = "messageSource")
public MessageSource configureMessageSource() {
    ReloadableResourceBundleMessageSource messageSource =
            new ReloadableResourceBundleMessageSource();
    messageSource.setBasenames(MESSAGE_SOURCE, MESSAGE_SOURCE_OVAL);
    messageSource.setCacheSeconds(MESSAGE_CACHE);
    messageSource.setFallbackToSystemLocale(false);
    // Make sure Apostrophs must always be doubled..
    messageSource.setAlwaysUseMessageFormat(true);
    // This persister doubles Apostoph
    messageSource
            .setPropertiesPersister(new ApostropheEscapingPropertiesPersister());
    return messageSource;
}
 
開發者ID:opensource21,項目名稱:fuwesta,代碼行數:20,代碼來源:TestConfig.java


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