Rails 3.2、i18n、i18n_routing を使用します。
私のURLの例
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) によって翻訳されます。コントローラーの名前は、この例では、houses controller/model です。
ちょうど 1 週間前に、Google webmastertools で警告メッセージが表示されました。このURLで
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
ロケール パラメータが「nl」ではなく「nltarget」に設定されていることを確認しました
ほとんどの場合、ロケール パラメータは次のように正しく設定されます。
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」に設定されている可能性はありますか?