有没有一种方法可以做到这样:
en:
welcome:
hello there, #{current_user.first_name}! It's nice to see you again.
显然那样做行不通,而且在yaml中 "#{" 是无效的字符,因为当我提取它时,该字符串只显示为"hello there, "。
我能做到的最好的方法是:
en:
welcome:
hello there, (name)! It's nice to see you again.
....
t(:welcome).gsub("(name)", current_user.first_name)
但我对此并不狂热...肯定有更好的方法来做这种事情。