有没有办法做这样的事情:
en:
welcome:
hello there, #{current_user.first_name}! It's nice to see you again.
这显然是行不通的,显然“#{”是yaml中的无效字符,因为当我把它拉出来时,那个字符串只显示为“你好”。
我能做的最好的事情就像:
en:
welcome:
hello there, (name)! It's nice to see you again.
....
t(:welcome).gsub("(name)", current_user.first_name)
但我并不为此疯狂......必须有更好的方法来做这种事情。