为您的 <title> 进行 I18n
Translations for \s!
Add to your translations:
en:
titles:
# titles.application defaults to the sigficant portion of
# AppName::Application, which would be:
application: AppName
dashboards:
show: Dashboard
users:
show: '%{user}'
new: RegistrationAnd to your HTML:
And to your User model:
def to_s
name
endYou can pass additional values to the #title helper, which can be referenced
in your translations:
en:
titles:
application: '%{user_name} - AppName'Though the idea of translating titles was arrived at seperately, Brandon Keepers wrote Abusing Rails I18N to Set Page Titles which outlines an extremely similar approach, and from whence came the idea of using the view context to get local assigns to be used in interpolation.
暂无开放 Issues,或尚未同步最近议题。