[英]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.