diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-02 14:58:51 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-02 14:58:51 +0200 |
| commit | 83548b09620aebbd43aa7a3c272cdd9cc18a13dc (patch) | |
| tree | d415e83c9ee511fae8b5a72ca722afd89543ae96 /app/controllers | |
| parent | f823d28749b8fc0c30fb92e1ffa8f9b6cb1b8c5d (diff) | |
Pick an existing translation when none has changed
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/revisions_controller.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/revisions_controller.rb b/app/controllers/revisions_controller.rb index b8e66218..cfd31308 100644 --- a/app/controllers/revisions_controller.rb +++ b/app/controllers/revisions_controller.rb | |||
| @@ -33,7 +33,13 @@ class RevisionsController < ApplicationController | |||
| 33 | 33 | ||
| 34 | @locale_summary = @end.locale_diff_summary(@start) | 34 | @locale_summary = @end.locale_diff_summary(@start) |
| 35 | requested_locale = params[:translation_locale].presence&.to_sym | 35 | requested_locale = params[:translation_locale].presence&.to_sym |
| 36 | default_locale = @locale_summary.find { |s| s[:changed] }&.dig(:locale) || I18n.default_locale | 36 | |
| 37 | available = @locale_summary.map { |s| s[:locale] } | ||
| 38 | default_locale = @locale_summary.find { |s| s[:changed] }&.dig(:locale) || | ||
| 39 | (I18n.default_locale if available.include?(I18n.default_locale)) || | ||
| 40 | available.first || | ||
| 41 | I18n.default_locale | ||
| 42 | |||
| 37 | @translation_locale = @locale_summary.any? { |s| s[:locale] == requested_locale } ? requested_locale : default_locale | 43 | @translation_locale = @locale_summary.any? { |s| s[:locale] == requested_locale } ? requested_locale : default_locale |
| 38 | 44 | ||
| 39 | @diff_view = params[:view] == "side_by_side" ? :side_by_side : :inline | 45 | @diff_view = params[:view] == "side_by_side" ? :side_by_side : :inline |
