Ruby on Rails设计翻译(Ruby on Rails devise translation)

编程入门 行业动态 更新时间:2024-10-26 21:26:11
Ruby on Rails设计翻译(Ruby on Rails devise translation)

意见/设计/会话/ new.html.haml

%h2 = t('devise.sessions.link')

设计无法找到翻译

<span class="translation_missing" title="translation missing: ru.devise.sessions.link">Link</span>

ru: devise: sessions: link: 'Войти'

存在于config / locales / devise.ru.yml中

views/devise/sessions/new.html.haml

%h2 = t('devise.sessions.link')

devise can't find the translation

<span class="translation_missing" title="translation missing: ru.devise.sessions.link">Link</span>

but

ru: devise: sessions: link: 'Войти'

is present in config/locales/devise.ru.yml

最满意答案

Rails正确合并解析后的yaml文件,但是当在同一个转换文件中使用两次密钥时,其中一个将被另一个替换,就像将现有密钥值对添加到手动创建的哈希时一样。

示例yaml文件:

---- :foo: bar :foo: foo

示例代码使用:

require 'rubygems' require 'yaml' YAML::load("--- \n:foo: :bar\n:foo: :foo\n")

输出:

=> {:foo=>:foo}

Rails merges the parsed yaml files correctly but, when a key is used twice within the same translation file, one of them will be replaced by the other, the same way it would when adding an existing key value pair to a manually created hash.

example yaml file:

---- :foo: bar :foo: foo

example code use:

require 'rubygems' require 'yaml' YAML::load("--- \n:foo: :bar\n:foo: :foo\n")

output:

=> {:foo=>:foo}

更多推荐

本文发布于:2023-07-17 10:10:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1142809.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Rails   Ruby   translation   devise

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!