gpt4 book ai didi

ruby-on-rails - 如何在 YAML 中声明同时包含单引号和双引号的字符串?

转载 作者:数据小太阳 更新时间:2023-10-29 06:25:08 25 4
gpt4 key购买 nike

我正在对一个应用程序进行国际化,但不知道如何声明一个包含单引号和双引号的翻译字符串。这是我正在尝试的 en.yml 字符串的示例

en:
my_string: When you're using double quotes, they look like "this"

使用上面的字符串,我得到以下错误:

can not load translations from /vagrant/config/locales/en.yml,
expected it to return a hash, but does not

如果只有双引号,我会用单引号括起来,反之亦然。我如何处理双引号和单引号?

最佳答案

转义应该这样进行

"When you're using double quotes, they look like \"this\""

关于ruby-on-rails - 如何在 YAML 中声明同时包含单引号和双引号的字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14992328/

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