【发布时间】:2012-08-23 13:58:31
【问题描述】:
我正在使用 Rails 中的语言,我想知道将单词大写时的最佳做法是什么。
en.yml:
hello: "hello"
application.html.erb:
<%= link_to t(:hello).capitalize, hello_path %> (with capitalization)
<%= link_to t(:hello), hello_path %> (without capitalization)
或
en.yml:
Hello: "Hello"
hello: "hello"
application.html.erb:
<%= link_to t(:Hello), hello_path %> (with capitalization)
<%= link_to t(:hello), hello_path %> (without capitalization)
【问题讨论】:
-
值得注意的是,语言的东西会很快变得非常复杂。这是一个非常简单的例子。你有更现实的用例吗?
标签: ruby-on-rails ruby internationalization