使用 rails 3.2、i18n、i18n_routing。
我的网址的一个例子
domain/nl/vakantiehuizen/house-property-name
domain/nl/vakantiehuizen/house-property-name/reviews
domain/en/ferienwohnung/house-property-name
domain/en/ferienwohnung/house-property-name
控制器名称(vakantiehuizen、ferienwohnung)由语言环境(de.yml、en.yml)翻译。控制器的名称是这个例子是房屋控制器/模型
就在一周前,我收到警告消息 google webmastertools!用这个网址
nltarget/houses/le-carpine/
nltarget/houses/le-carpine/reviews
500 响应,因为此页面不存在。
这里有什么问题?糟糕/缓慢的服务器响应?
日志文件的一部分:
House::Translation Load (0.4ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 17 AND `house_translations`.`locale` = 'nltarget' LIMIT 1
House::Translation Load (0.3ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 20 AND `house_translations`.`locale` = 'nltarget' LIMIT 1
House::Translation Load (0.3ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 24 AND `house_translations`.`locale` = 'nltarget' LIMIT 1
House::Translation Load (0.4ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 13 AND `house_translations`.`locale` = 'nltarget' LIMIT 1
House::Translation Load (0.3ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 2 AND `house_translations`.`locale` = 'nltarget' LIMIT 1
House::Translation Load (0.3ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 4 AND `house_translations`.`locale` = 'nltarget' LIMIT 1
House::Translation Load (0.3ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 25 AND `house_translations`.`locale` = 'nltarget' LIMIT 1
House::Translation Load (0.5ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 19 AND `house_translations`.`locale` = 'nltarget' LIMIT 1
Appartment::Translation Load (0.5ms) SELECT `appartment_translations`.* FROM `appartment_translations` WHERE `appartment_translations`.`appartment_id` = 22 AND `appartment_translations`.`locale` = 'nltarget' LIMIT 1
我已经看到语言环境参数设置为“nltarget”而不是“nl”
大多数情况下,语言环境参数设置正确,如下所示:
House::Translation Load (0.4ms) SELECT `house_translations`.* FROM `house_translations` WHERE `house_translations`.`house_id` = 13 AND `house_translations`.`locale` = 'nl' LIMIT 1
Amenity::Translation Load (0.3ms) SELECT `amenity_translations`.* FROM `amenity_translations` WHERE `amenity_translations`.`amenity_id` = 13 AND `amenity_translations`.`locale` = 'nl' LIMIT 1
Review::Translation Load (0.3ms) SELECT `review_translations`.* FROM `review_translations` WHERE `review_translations`.`review_id` IS NULL AND `review_translations`.`locale` = 'nl' LIMIT 1
Amenity::Translation Load (0.4ms) SELECT `amenity_translations`.* FROM `amenity_translations` WHERE `amenity_translations`.`amenity_id` = 13 AND `amenity_translations`.`locale` = 'nl' LIMIT 1
语言环境“nl”怎么可能设置为“nltarget”?