【发布时间】:2011-09-26 01:12:38
【问题描述】:
有没有办法做这样的事情:
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)
但我对此并不感到疯狂......必须有更好的方法来做这种事情。
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 yaml