Ruby on rails RubyonRails如何调用locale消息来查看
这是我的config/locales/en.yml文件:Ruby on rails RubyonRails如何调用locale消息来查看,ruby-on-rails,ruby,locale,Ruby On Rails,Ruby,Locale,这是我的config/locales/en.yml文件: # Sample localization file for English. Add more files in this directory for other locales. # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. en: hello: "Hello world" signu
# Sample localization file for English. Add more files in this directory for other locales.
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
en:
hello: "Hello world"
signup_title: "Sign Up for Test"
我在视图中调用此文件中的消息的内容(可能使用错误)
当然,我也会犯一些错误
undefined local variable or method `en' for #<#<Class:0x007fd14d4f4338>:0x007fd14d501fb0>
未定义的局部变量或方法“en”#
那么,如何在没有任何错误的情况下获取消息值呢
<h1><%= t 'signup_title' %></h1>
有关不同的位置,请参见使用此:
请阅读以下内容:
<h1><%= t 'signup_title' %></h1>
<h1><%= translate 'signup_title' %></h1>