diff --git a/app/models/communication/website/page/with_path.rb b/app/models/communication/website/page/with_path.rb index 99b4692e3c6dbc8efee742b5d5a6185543c07d23..5caa467aad31be832100e9025ecec35169cd6d05 100644 --- a/app/models/communication/website/page/with_path.rb +++ b/app/models/communication/website/page/with_path.rb @@ -8,9 +8,8 @@ module Communication::Website::Page::WithPath def path path = '' - # TODO i18n remplacer le choix de la langue if website.languages.many? - path += "/#{website.default_language.iso_code}" + path += "/#{language.iso_code}" end path += "/#{slug_with_ancestors}/" path.gsub(/\/+/, '/') diff --git a/app/models/concerns/with_git.rb b/app/models/concerns/with_git.rb index 6fec8601b9fbb866450d12192d19f6abd910f77a..618f08e344d989b963df928e0cdf99383e7226fe 100644 --- a/app/models/concerns/with_git.rb +++ b/app/models/concerns/with_git.rb @@ -14,10 +14,11 @@ module WithGit def git_path_content_prefix(website) # Handle legacy language-less websites - # TODO I18n: Right now, we use the language of the website. It HAS TO get the language from the object including this concern. + # TODO I18n: Right now, we use the language of the object, fallbacking on the language of the website. In the end, we'll only use the language of the object path = "content/" if website.languages.any? - path += "#{website.default_language.iso_code}/" + path_language = respond_to?(:language_id) && language_id.present? ? language : website.default_language + path += "#{path_language.iso_code}/" end path end