0
我即将把所有时区的俄罗斯和我做这样的事情:的I18n翻译问题
型号:
# lib/i18n_time_zone.rb
class I18nTimeZone < ActiveSupport::TimeZone
def self.all
super.map { |z| create(z.name, z.utc_offset) }
end
def to_s
translated_name = I18n.t(name, :scope => :timezones, :default => name)
"(GMT#{formatted_offset}) #{translated_name}"
end
end
观点:
<%= time_zone_select :user, :time_zone, nil, :model => I18nTimeZone %>
区域设置文件( /config/locales/ru.yml):
ru:
timezones:
"Midway Island": "Мидуэй"
"Samoa": "Самоа"
....
但有些情况下,原始字符串包含一些点(“。”)像“St.圣彼得堡” 而I18n.t()告诉我,翻译缺失。
我怎样才能避免呢?
Tnanks!它确实有效。 – kshchepelin 2010-05-01 20:20:32