当前位置: 首页>>代码示例>>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;未经允许,请勿转载。