Kohana 3 - 如何国际化由数据库填充的表单字段?
我的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
好吧,我刚刚想出了一个解决方案。
我发现数组中的第二个参数(值)不需要是字符串对象。所以我只是将其设为 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.