Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails 4缺少翻译I18n,带有ice_cube gem_Ruby On Rails_Internationalization - Fatal编程技术网

Ruby on rails Rails 4缺少翻译I18n,带有ice_cube gem

Ruby on rails Rails 4缺少翻译I18n,带有ice_cube gem,ruby-on-rails,internationalization,Ruby On Rails,Internationalization,我正在尝试使用I18n解决rails 4应用程序中缺少的翻译问题 我得到的错误如下所示: translation missing: en.ice_cube.each_day 2.1.1 :061 > y['en']['ice_cube'] => {"pieces_connector"=>" / ", "not"=>"not %{target}", "not_on"=>"not on %{target}", "date"=>{"formats"=>{"d

我正在尝试使用I18n解决rails 4应用程序中缺少的翻译问题

我得到的错误如下所示:

translation missing: en.ice_cube.each_day
2.1.1 :061 > y['en']['ice_cube']
=> {"pieces_connector"=>" / ", "not"=>"not %{target}", "not_on"=>"not on %{target}", "date"=>{"formats"=>{"default"=>"%B %-d, %Y"}, "month_names"=>[nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "day_names"=>["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]}, "times"=>{"other"=>"%{count} times", "one"=>"%{count} time"}, "until"=>"until %{date}", "days_of_week"=>"%{segments} %{day}", "days_of_month"=>{"other"=>"%{segments} days of the month", "one"=>"%{segments} day of the month"}, "days_of_year"=>{"other"=>"%{segments} days of the year", "one"=>"%{segments} day of the year"}, "at_hours_of_the_day"=>{"other"=>"on the %{segments} hours of the day", "one"=>"on the %{segments} hour of the day"}, "on_minutes_of_hour"=>{"other"=>"on the %{segments} minutes of the hour", "one"=>"on the %{segments} minute of the hour"}, "at_seconds_of_minute"=>{"other"=>"at the %{segments} seconds", "one"=>"at the %{segments} second"}, "on_seconds_of_minute"=>{"other"=>"on the %{segments} seconds of the minute", "one"=>"on the %{segments} second of the minute"}, "each_second"=>{"one"=>"Secondly", "other"=>"Every %{count} seconds"}, "each_minute"=>{"one"=>"Minutely", "other"=>"Every %{count} minutes"}, "each_hour"=>{"one"=>"Hourly", "other"=>"Every %{count} hours"}, "each_day"=>{"one"=>"Daily", "other"=>"Every %{count} days"}, "each_week"=>{"one"=>"Weekly", "other"=>"Every %{count} weeks"}, "each_month"=>{"one"=>"Monthly", "other"=>"Every %{count} months"}, "each_year"=>{"one"=>"Yearly", "other"=>"Every %{count} years"}, "on"=>"on the %{sentence}", "in"=>"in %{target}", "integer"=>{"negative"=>"%{ordinal} to last", "literal_ordinals"=>{-1=>"last", -2=>"2nd to last"}, "ordinal"=>"%{number}%{ordinal}", "ordinals"=>{"default"=>"th", 1=>"st", 2=>"nd", 3=>"rd", 11=>"th", 12=>"th", 13=>"th"}}, "on_weekends"=>"on Weekends", "on_weekdays"=>"on Weekdays", "days_on"=>["Sundays", "Mondays", "Tuesdays", "Wednesdays", "Thursdays", "Fridays", "Saturdays"], "on_days"=>"on %{days}", "array"=>{"last_word_connector"=>", and ", "two_words_connector"=>" and ", "words_connector"=>", "}, "string"=>{"format"=>{"day"=>"%{rest} %{current}", "day_of_week"=>"%{rest} %{current}", "day_of_month"=>"%{rest} %{current}", "day_of_year"=>"%{rest} %{current}", "hour_of_day"=>"%{rest} %{current}", "minute_of_hour"=>"%{rest} %{current}", "until"=>"%{rest} %{current}", "count"=>"%{rest} %{current}", "default"=>"%{rest} %{current}"}}} 
所以我检查翻译应该来自哪里,应该在/usr/local/rvm/gems/ruby-2.1中。1@nacore/gems/ice_cube-0.14.0/config/locales/en.yml。然后检查I18n.load_路径和/usr/local/rvm/gems/ruby-2.1。1@nacore/gems/ice_cube-0.14.0/config/locales/en.yml肯定在那里。然后我检查翻译,我得到:

2.1.1 :054 > I18n.t('ice_cube')
=> {:string=>{:format=>{:day=>"%{rest} %{current}", :day_of_week=>"%{rest} %{current}", :day_of_month=>"%{rest} %{current}", :day_of_year=>"%{rest} %{current}", :hour_of_day=>"%{rest} %{current}", :minute_of_hour=>"%{rest} %{current}", :until=>"%{rest} %{current}", :count=>"%{rest} %{current}", :default=>"%{rest} %{current}"}}} 
这与我在引入/usr/local/rvm/gems/ruby-2.1的内容时得到的结果非常不同。1@nacore/将gems/ice_cube-0.14.0/config/locales/en.yml转换为如下哈希:

translation missing: en.ice_cube.each_day
2.1.1 :061 > y['en']['ice_cube']
=> {"pieces_connector"=>" / ", "not"=>"not %{target}", "not_on"=>"not on %{target}", "date"=>{"formats"=>{"default"=>"%B %-d, %Y"}, "month_names"=>[nil, "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], "day_names"=>["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]}, "times"=>{"other"=>"%{count} times", "one"=>"%{count} time"}, "until"=>"until %{date}", "days_of_week"=>"%{segments} %{day}", "days_of_month"=>{"other"=>"%{segments} days of the month", "one"=>"%{segments} day of the month"}, "days_of_year"=>{"other"=>"%{segments} days of the year", "one"=>"%{segments} day of the year"}, "at_hours_of_the_day"=>{"other"=>"on the %{segments} hours of the day", "one"=>"on the %{segments} hour of the day"}, "on_minutes_of_hour"=>{"other"=>"on the %{segments} minutes of the hour", "one"=>"on the %{segments} minute of the hour"}, "at_seconds_of_minute"=>{"other"=>"at the %{segments} seconds", "one"=>"at the %{segments} second"}, "on_seconds_of_minute"=>{"other"=>"on the %{segments} seconds of the minute", "one"=>"on the %{segments} second of the minute"}, "each_second"=>{"one"=>"Secondly", "other"=>"Every %{count} seconds"}, "each_minute"=>{"one"=>"Minutely", "other"=>"Every %{count} minutes"}, "each_hour"=>{"one"=>"Hourly", "other"=>"Every %{count} hours"}, "each_day"=>{"one"=>"Daily", "other"=>"Every %{count} days"}, "each_week"=>{"one"=>"Weekly", "other"=>"Every %{count} weeks"}, "each_month"=>{"one"=>"Monthly", "other"=>"Every %{count} months"}, "each_year"=>{"one"=>"Yearly", "other"=>"Every %{count} years"}, "on"=>"on the %{sentence}", "in"=>"in %{target}", "integer"=>{"negative"=>"%{ordinal} to last", "literal_ordinals"=>{-1=>"last", -2=>"2nd to last"}, "ordinal"=>"%{number}%{ordinal}", "ordinals"=>{"default"=>"th", 1=>"st", 2=>"nd", 3=>"rd", 11=>"th", 12=>"th", 13=>"th"}}, "on_weekends"=>"on Weekends", "on_weekdays"=>"on Weekdays", "days_on"=>["Sundays", "Mondays", "Tuesdays", "Wednesdays", "Thursdays", "Fridays", "Saturdays"], "on_days"=>"on %{days}", "array"=>{"last_word_connector"=>", and ", "two_words_connector"=>" and ", "words_connector"=>", "}, "string"=>{"format"=>{"day"=>"%{rest} %{current}", "day_of_week"=>"%{rest} %{current}", "day_of_month"=>"%{rest} %{current}", "day_of_year"=>"%{rest} %{current}", "hour_of_day"=>"%{rest} %{current}", "minute_of_hour"=>"%{rest} %{current}", "until"=>"%{rest} %{current}", "count"=>"%{rest} %{current}", "default"=>"%{rest} %{current}"}}} 
应用程序使用的来自ice_cube的翻译似乎只是/usr/local/rvm/gems/ruby-2.1中的一小部分。1@nacore/gems/ice_cube-0.14.0/config/locales/en.yml文件。。。 该应用程序部署在十几台服务器上,并且在所有服务器上都可以使用。这到底是怎么回事