gpt4 book ai didi

ruby-on-rails - 如何在 Rails 上的 .yml 本地化文件中换行?

转载 作者:行者123 更新时间:2023-12-03 01:29:35 28 4
gpt4 key购买 nike

我有一个带有一些本地化内容的 terms.en.yml 文件,例如:

en:
devise:
registrations:
terms:
text: 'This agreement was written in English (US). To the extent any translated version of this agreement conflicts with the English version, the English version controls. Please note that Section 16 contains certain changes to the general terms for users outside the United States.\n\ Some new line'

我怎样才能在那里换行或创建一个段落?

这里有一些信息,但它对我没有帮助,我一直在做错事。 http://yaml.org/spec/1.1/#b-paragraph-separator

最佳答案

这对我有用:

en:
hello: "Hello world"
bye: |
Bye!
See you!
error: >
Something happend.
Try later.

用法:

irb(main):001:0> I18n.t 'bye'
=> "Bye!\nSee you!\n"
irb(main):002:0> I18n.t 'error'
=> "Something happend. Try later.\n"

关于ruby-on-rails - 如何在 Rails 上的 .yml 本地化文件中换行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10982706/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com