Tapestry:起始页使用英语区域设置而不是默认区域设置

发布于 2025-01-03 16:07:33 字数 1970 浏览 1 评论 0原文

我们使用 Tapestry 5.1.0.5 构建了一个网站,有时,当我们点击起始页时,我们会遇到缺少关键的问题。

这个问题只出现了4次,这是一个随机问题。

实际配置:

  • configuration.add(SymbolConstants.SUPPORTED_LOCALES, "fr"); =>因此默认本地是 fr 而不是 en

  • configuration.add("tapestry.start-page-name", "Accueil"); =>因此,当我们点击 / 时,tapestry 会将我们重定向到 /accueil

这是我们有时会看到的问题:

当点击 / 时Tapestry 在 *_en.properties 中搜索键,而不是在 *_fr.properties 中,但如果我们点击 /accueil Tapestry 搜索键在*_fr.properties

跟踪日志:

Caused by: java.lang.NumberFormatException: For input string: **"[[missing key: prehome.store.opening.delay]]"**
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:447)
        at java.lang.Integer.parseInt(Integer.java:497)
        at XXXXXXX.tapestry.components.overlayer.StoreOverlayer.initStoresAndRegions(StoreOverlayer.java:652)
        at XXXXXXX.tapestry.components.overlayer.StoreOverlayer.setupRender(StoreOverlayer.java)
        at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:184)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164)
        at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
        ... 94 more

01-02-2012 11:55:52:979 23120252 ERROR org.apache.tapestry5.internal.services.InternalModule.PagePool  - Page Page[Accueil en] is dirty, and will be discarded (rather than returned to the page pool).

有人遇到过这个问题吗?

您知道为什么当我们点击起始页时,tapestry 使用 en 语言环境而不是默认语言环境 fr 吗?

We built a website with Tapestry 5.1.0.5 and we encounter, sometimes, a missing key problem when we hit the start-page.

This problem appeared only 4 times, this is a random issue.

Actual configuration:

  • configuration.add(SymbolConstants.SUPPORTED_LOCALES, "fr"); => so the default local is fr and not en

  • configuration.add("tapestry.start-page-name", "Accueil"); => so when we hit / tapestry redirects us on /accueil

Here is the problem we sometimes see:

When hitting / tapestry searches keys in *_en.properties instead of *_fr.properties but if we hit /accueil tapestry searches keys in *_fr.properties.

Trace log :

Caused by: java.lang.NumberFormatException: For input string: **"[[missing key: prehome.store.opening.delay]]"**
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Integer.parseInt(Integer.java:447)
        at java.lang.Integer.parseInt(Integer.java:497)
        at XXXXXXX.tapestry.components.overlayer.StoreOverlayer.initStoresAndRegions(StoreOverlayer.java:652)
        at XXXXXXX.tapestry.components.overlayer.StoreOverlayer.setupRender(StoreOverlayer.java)
        at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:184)
at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.run(ComponentPageElementImpl.java:164)
        at org.apache.tapestry5.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:933)
        ... 94 more

01-02-2012 11:55:52:979 23120252 ERROR org.apache.tapestry5.internal.services.InternalModule.PagePool  - Page Page[Accueil en] is dirty, and will be discarded (rather than returned to the page pool).

Has anyone had this problem?

Do you know why when we hit the start-page, tapestry use en locale instead of our default locale fr?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独自唱情﹋歌 2025-01-10 16:07:33

我想说,如果您想确保默认区域设置是法语,那么只需将所有 message_fr.properties 重命名为 message.properties 即可。

另请查看浏览器设置。如果您的浏览器请求该网站的英文版本,则 Tapestry 会遵循。您可以覆盖该行为,但我建议将其视为一项功能(因为用户正在获取与其偏好相关的网站)而不是错误。

最后提示,如果您支持多种语言,请将它们全部列在支持的语言环境常量中。

- = 编辑 = -
也许还值得检查一下您是否有英语或法语的全局 messages.properties 文件

I'd say that if you want to ensure that default locale is French, then just rename all message_fr.properties to message.properties.

Also please take a look into browser settings. If your browser is requesting English version of the site, then Tapestry obeys. You may override that behavior, but I'd suggest treating that like a feature (as user is getting site related to his preference) rather than a bug.

And last hint, if you are supporting more than one language then list them all in supported locales constant.

-= Edit =-
it's also probably worth checking do you have the global messages.properties file in English or in French

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文