问题
I'm developing an application with Rails 4 and I want to use the helper t() with HAML, but I can not
Example usage:
=model_name = @article.class.model_name.human
%h1 Create t(:model_name)
My first line shows me the correct article, but when I use t() it shows me t(:model_name). Thanks.
回答1:
hope in translational file you have en.yml
en:
article: MyArticle
Then
%h2= t 'article'
if you want dynamically ``
%h2= t '#{model_name}'
来源:https://stackoverflow.com/questions/33873894/how-to-use-the-haml-t-helper-in-ror