[英]Translation of “will_paginate” doesn't work. What am I doing wrong?
基本方案:
= will_paginate @products, :previous_label => t("previous_label"), :next_label => t("next_label")
deyyml
will_paginate:
page_gap: "…"
previous_label: "word for back"
next_label: "word for next"
zh- cn.yml zh:will_paginate:page_gap:“…” previous_label:“上一个” next_label:“下一个”
但是在输出中仍然是名为Previous Label
和Next Label
。 还有什么问题? 另外,我以为我没有重新启动服务器...但是重新启动后仍然是相同的标签,而不是我的翻译
您可以在此处获取将will_paginate转换为各种语言的YAML文件: https : //github.com/tigrish/will-paginate-i18n 。
在您的示例中,您覆盖了:previous_label和:next_label,但没有将其范围限定为'will_paginate'。
完全删除替代项并自定义翻译文件中的标签:
will_paginate @products
或正确设置.t
调用的范围:
will_paginate @products,
:previous_label => t("will_paginate.previous_label"),
:next_label => t("will_paginate.next_label")
然后可以通过将以下内容添加到config/locales/will_paginate.en.yml:
来更改分页链接的文本config/locales/will_paginate.en.yml:
en:
will_paginate:
page_gap: "…"
previous_label: "previous"
next_label: "next"
并在application.rb
添加以下内容
config.i18n.default_locale = :en
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.