简体   繁体   English

如何在没有运行的wicket应用程序的情况下使用wicket i18n功能

[英]How can I use wicket i18n features without a running wicket application

Given: 鉴于:

  • a wicket application with fully configured *.properties files for multiple languages 具有完全配置的*.properties文件以支持多种语言的检票口应用程序

Required: 需要:

  • a batch application should also be able to get a localized value, using key and locale, with locale fallbacks and so on, behaving just like wicket normally does this. 批处理应用程序还应该能够使用键和语言环境以及具有语言环境回退等功能来获得本地化的值,就像检票口通常这样做一样。

Tried so far: 到目前为止已尝试:

  • WicketApplication.get().getResourceSettings().getLocalizer() - does not work, as no wicket application is available in the context of batch application. WicketApplication.get().getResourceSettings().getLocalizer() -不起作用,因为在批处理应用程序的上下文中没有可用的小门应用程序。

See org.apache.wicket.resource.loader.ComponentStringResourceLoader#loadStringResource(java.lang.Class, java.lang.String, java.util.Locale, java.lang.String, java.lang.String) [1]. 请参见org.apache.wicket.resource.loader.ComponentStringResourceLoader#loadStringResource(java.lang.Class,java.lang.String,java.util.Locale,java.lang.String,java.lang.String)[1]。 This is where the magic happens. 这就是魔术发生的地方。

  1. https://github.com/apache/wicket/blob/792a0a4138aad61dfe63c8bace96648878767003/wicket-core/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java#L131-L151 https://github.com/apache/wicket/blob/792a0a4138aad61dfe63c8bace96648878767003/wicket-core/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java#L131-L151

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM