Kohana 3 - 如何国际化由数据库填充的表单字段?

发布于 2024-10-15 20:29:20 字数 194 浏览 6 评论 0原文

我的 Kohana 3 应用程序中有类似联系表的东西。现在客户想要的是一个选择字段,让客户有机会选择他/她的国家/地区。 那可能很容易。但客户希望能够控制所包含的国家/地区。所以我选择了数据库方式来完成它。 我有一个数据库表国家/地区,其中包含以下字段 代码、标题 'de', 'Germany'

现在我希望这些值在我的表单中进行国际化。 有人知道答案吗?

I have something like a contact-form in my Kohana 3 app. Now what the customer wants to have is a select-field which gives the customer the chance to select his/her country.
That could be pretty easy. But the customer wants to have control over the countries which are included. So I chose for the database-way to do it.
I have a database table countries that has fields like
code, title
'de', 'Germany'

Now I want these values to be i18n-ed in my form.
Anyone knows the answer?

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

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

发布评论

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

评论(1

放飞的风筝 2024-10-22 20:29:20

好吧,我刚刚想出了一个解决方案。
我发现数组中的第二个参数(值)不需要是字符串对象。所以我只是将其设为 i18n kohana 对象。
现在一切都按预期进行。
无论如何,谢谢!

如果你们想看代码示例。只是评论我的解决方案。

另外,如果你们知道更好的解决方案。评论我的解决方案。

Ok I just figured out a solution.
I figured out that the second parameter in an array (the value) doesn't need to be a string object. So I just made it an i18n kohana object.
Now everything works as expected.
Thanks anyway!

If you guys wanna see a code example. Just comment on my solution.

Also if you guys know a better solution. Comment my solution.

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