我正在对一个应用程序进行国际化,但不知道如何声明一个包含单引号和双引号的翻译字符串。这是我正在尝试的 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/