使用 Tapestry-3 将 I18n 文本注入 javascript
我正在将国际化添加到 Tapestry 应用程序中。
是否有标准的 Tapestry-3 技术来国际化显示为 Javascript 文字的字符串?
例如:
<input jwcid="submitBtn" type="submit" accesskey="U" value="Update" class="actionBtn" onclick="return confirm('Are you sure that you want to do that?');"/></td>
我可以简单地将问题替换为在此上下文和任何其他上下文中的挂毯标签吗? 可以这么说:
<input jwcid="submitBtn" type="submit" accesskey="U" value="Update" class="actionBtn" onclick="return confirm('<span key="AreYouSure">Are you sure that you want to do that?</span>');"/></td>
这意味着源文件在属性中包含一个元素,该元素在 JSP 中就可以了。 Tapestry-3 可以处理这个问题吗? 如果没有,有没有办法在 Tapestry-3 中做到这一点?
I'm adding Internationalization to a tapestry app.
Is there a standard tapestry-3 technique to Internationalize strings that appear as Javascript literals?
For example:
<input jwcid="submitBtn" type="submit" accesskey="U" value="Update" class="actionBtn" onclick="return confirm('Are you sure that you want to do that?');"/></td>
Can I simply replace the question with a tapestry tag in this and any other context? Say something like:
<input jwcid="submitBtn" type="submit" accesskey="U" value="Update" class="actionBtn" onclick="return confirm('<span key="AreYouSure">Are you sure that you want to do that?</span>');"/></td>
This means that the source file contains an element inside an attribute which would be fine inside a JSP. Does tapestry-3 handle this? If not, is there a way to do this in tapestry-3?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这在 T3 中也可以正常工作 - 另一个选择是在页面顶部初始化 i18n js 字符串:
然后使用它们:
This works fine in T3 as well - another option is to initialize your i18n js strings at the top of the page:
and then just use them: