]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/diary_entries_controller.rb
Merge remote-tracking branch 'upstream/pull/4513'
[rails.git] / app / controllers / diary_entries_controller.rb
index 6db32797adffe5c582a381f8000781ae4090e97e..1f9574b9cbab8313e7cc0e9b7540c85ae5d9f3fe 100644 (file)
@@ -47,6 +47,8 @@ class DiaryEntriesController < ApplicationController
         @title = t ".in_language_title", :language => Language.find(params[:language]).english_name
         entries = entries.where(:language_code => params[:language])
       else
         @title = t ".in_language_title", :language => Language.find(params[:language]).english_name
         entries = entries.where(:language_code => params[:language])
       else
+        candidate_codes = preferred_languages.flat_map(&:candidates).uniq.map(&:to_s)
+        @languages = Language.where(:code => candidate_codes).in_order_of(:code, candidate_codes)
         @title = t ".title"
       end
     end
         @title = t ".title"
       end
     end