如何在 ruby on Rails 中本地化 will_paginate ?
我喜欢本地化 will_paginate 中的“上一个”和“下一个”链接,我该怎么做? 有人找到一个好的解决方法吗?
I like to localize the "previous" and "next" links in will_paginate, how can I do that?
Did anyone find a nice workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
万一其他人发现了该线程...,现在有另一个解决方案。
https://github.com/mislav/will_paginate/wiki/I18n
以下内容摘录从上面的链接。
从 will_paginate v2.3.16 和 v3.0 开始,will_paginate 视图助手的一些输出和 page_entries_info 助手的完整输出可以通过 i18n 库进行翻译。
在 Rails 中,这通常意味着在“config/locale/”目录中以 YAML 或 ruby 格式添加翻译。
will_paginate 帮助器的翻译键和默认值可以在此处查看:
In case someone else found the thread..., there is an another solution now.
https://github.com/mislav/will_paginate/wiki/I18n
The following is extracted from the above link.
As of will_paginate v2.3.16 and v3.0, some output of will_paginate view helper and the complete output of page_entries_info helper can be translated by means of the i18n library.
In Rails, this usually means adding your translations in YAML or ruby format in the "config/locale/" directory.
Translation keys and default values for the will_paginate helper can be seen here:
will_paginate
接受选项哈希,包括自定义上一个/下一个标签的选项。will_paginate
accepts a Hash of options, including options to customize the previous/next labels.