From 58b3b7732bc96ce4c3f113b79733ec34f7465047 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Tue, 20 Nov 2018 12:38:52 +0200 Subject: Externalize strings from `/app/views/projects/diffs` --- app/views/projects/diffs/_collapsed.html.haml | 4 ++-- app/views/projects/diffs/_diffs.html.haml | 2 +- app/views/projects/diffs/_file.html.haml | 2 +- app/views/projects/diffs/_file_header.html.haml | 2 +- app/views/projects/diffs/_render_error.html.haml | 2 +- app/views/projects/diffs/_stats.html.haml | 2 +- app/views/projects/diffs/_text_file.html.haml | 2 +- app/views/projects/diffs/_warning.html.haml | 14 ++++++-------- app/views/projects/diffs/viewers/_added.html.haml | 2 +- app/views/projects/diffs/viewers/_deleted.html.haml | 2 +- app/views/projects/diffs/viewers/_mode_changed.html.haml | 2 +- app/views/projects/diffs/viewers/_no_preview.html.haml | 2 +- app/views/projects/diffs/viewers/_not_diffable.html.haml | 2 +- app/views/projects/diffs/viewers/_renamed.html.haml | 2 +- 14 files changed, 20 insertions(+), 22 deletions(-) (limited to 'app/views') diff --git a/app/views/projects/diffs/_collapsed.html.haml b/app/views/projects/diffs/_collapsed.html.haml index 9bd1255fe00..94dcda38bd6 100644 --- a/app/views/projects/diffs/_collapsed.html.haml +++ b/app/views/projects/diffs/_collapsed.html.haml @@ -1,5 +1,5 @@ - diff_file = viewer.diff_file - url = url_for(safe_params.merge(action: :diff_for_path, old_path: diff_file.old_path, new_path: diff_file.new_path, file_identifier: diff_file.file_identifier)) .nothing-here-block.diff-collapsed{ data: { diff_for_path: url } } - This diff is collapsed. - %button.click-to-expand.btn.btn-link Click to expand it. + = _("This diff is collapsed.") + %button.click-to-expand.btn.btn-link= _("Click to expand it.") diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml index 077c6c68f7e..9de3c2db6e7 100644 --- a/app/views/projects/diffs/_diffs.html.haml +++ b/app/views/projects/diffs/_diffs.html.haml @@ -8,7 +8,7 @@ .files-changed-inner .inline-parallel-buttons.d-none.d-sm-none.d-md-block - if !diffs_expanded? && diff_files.any? { |diff_file| diff_file.collapsed? } - = link_to 'Expand all', url_for(safe_params.merge(expanded: 1, format: nil)), class: 'btn btn-default' + = link_to _('Expand all'), url_for(safe_params.merge(expanded: 1, format: nil)), class: 'btn btn-default' - if show_whitespace_toggle - if current_controller?(:commit) = commit_diff_whitespace_link(diffs.project, @commit, class: 'd-none d-sm-inline-block') diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml index b4df654c839..1f90acaabcc 100644 --- a/app/views/projects/diffs/_file.html.haml +++ b/app/views/projects/diffs/_file.html.haml @@ -12,7 +12,7 @@ - blob = diff_file.blob .file-actions.d-none.d-sm-block - if blob&.readable_text? - = link_to '#', class: 'js-toggle-diff-comments btn active has-tooltip', title: "Toggle comments for this file", disabled: @diff_notes_disabled do + = link_to '#', class: 'js-toggle-diff-comments btn active has-tooltip', title: _("Toggle comments for this file"), disabled: @diff_notes_disabled do = icon('comment') \ - if editable_diff?(diff_file) diff --git a/app/views/projects/diffs/_file_header.html.haml b/app/views/projects/diffs/_file_header.html.haml index 4cb04d744dc..6a1bff8640c 100644 --- a/app/views/projects/diffs/_file_header.html.haml +++ b/app/views/projects/diffs/_file_header.html.haml @@ -28,7 +28,7 @@ = diff_file.file_path - if diff_file.deleted_file? - deleted + = _("deleted") = copy_file_path_button(diff_file.file_path) diff --git a/app/views/projects/diffs/_render_error.html.haml b/app/views/projects/diffs/_render_error.html.haml index 47a9ac3ee6b..c3dc47a56a7 100644 --- a/app/views/projects/diffs/_render_error.html.haml +++ b/app/views/projects/diffs/_render_error.html.haml @@ -1,5 +1,5 @@ .nothing-here-block - This #{viewer.switcher_title} could not be displayed because #{diff_render_error_reason(viewer)}. + = _("This %{viewer} could not be displayed because %{reason}.") % { viewer: viewer.switcher_title, reason: diff_render_error_reason(viewer) } You can = diff_render_error_options(viewer).to_sentence(two_words_connector: ' or ', last_word_connector: ', or ').html_safe diff --git a/app/views/projects/diffs/_stats.html.haml b/app/views/projects/diffs/_stats.html.haml index 229a4574eeb..c9057f385da 100644 --- a/app/views/projects/diffs/_stats.html.haml +++ b/app/views/projects/diffs/_stats.html.haml @@ -38,4 +38,4 @@ \-#{diff_file.removed_lines} %li.dropdown-menu-empty-item.hidden %a - No files found. + = _("No files found.") diff --git a/app/views/projects/diffs/_text_file.html.haml b/app/views/projects/diffs/_text_file.html.haml index bc9f6c71fa8..56427a74d56 100644 --- a/app/views/projects/diffs/_text_file.html.haml +++ b/app/views/projects/diffs/_text_file.html.haml @@ -1,7 +1,7 @@ - too_big = diff_file.diff_lines.count > Commit::DIFF_SAFE_LINES - if too_big .suppressed-container - %a.show-suppressed-diff.js-show-suppressed-diff Changes suppressed. Click to show. + %a.show-suppressed-diff.js-show-suppressed-diff= _("Changes suppressed. Click to show.") %table.text-file.diff-wrap-lines.code.js-syntax-highlight.commit-diff{ data: diff_view_data, class: too_big ? 'hide' : '' } = render partial: "projects/diffs/line", diff --git a/app/views/projects/diffs/_warning.html.haml b/app/views/projects/diffs/_warning.html.haml index abe494f2974..2eef599cf84 100644 --- a/app/views/projects/diffs/_warning.html.haml +++ b/app/views/projects/diffs/_warning.html.haml @@ -1,14 +1,12 @@ .alert.alert-warning %h4 - Too many changes to show. + = _("Too many changes to show.") .float-right - if current_controller?(:commit) - = link_to "Plain diff", project_commit_path(@project, @commit, format: :diff), class: "btn btn-sm" - = link_to "Email patch", project_commit_path(@project, @commit, format: :patch), class: "btn btn-sm" + = link_to _("Plain diff"), project_commit_path(@project, @commit, format: :diff), class: "btn btn-sm" + = link_to _("Email patch"), project_commit_path(@project, @commit, format: :patch), class: "btn btn-sm" - elsif current_controller?('projects/merge_requests/diffs') && @merge_request&.persisted? - = link_to "Plain diff", merge_request_path(@merge_request, format: :diff), class: "btn btn-sm" - = link_to "Email patch", merge_request_path(@merge_request, format: :patch), class: "btn btn-sm" + = link_to _("Plain diff"), merge_request_path(@merge_request, format: :diff), class: "btn btn-sm" + = link_to _("Email patch"), merge_request_path(@merge_request, format: :patch), class: "btn btn-sm" %p - To preserve performance only - %strong #{diff_files.size} of #{diff_files.real_size} - files are displayed. + = _("To preserve performance only %{display_size} of ${real_size} files are displayed.").html_safe % { display_size: diff_files.size, real_size: diff_files.real_size } diff --git a/app/views/projects/diffs/viewers/_added.html.haml b/app/views/projects/diffs/viewers/_added.html.haml index 8004fe16688..f4c574a018f 100644 --- a/app/views/projects/diffs/viewers/_added.html.haml +++ b/app/views/projects/diffs/viewers/_added.html.haml @@ -1,2 +1,2 @@ .nothing-here-block - File added + = _("File added") diff --git a/app/views/projects/diffs/viewers/_deleted.html.haml b/app/views/projects/diffs/viewers/_deleted.html.haml index 0ac7b4ca8f6..b82ca4d0787 100644 --- a/app/views/projects/diffs/viewers/_deleted.html.haml +++ b/app/views/projects/diffs/viewers/_deleted.html.haml @@ -1,2 +1,2 @@ .nothing-here-block - File deleted + = _("File deleted") diff --git a/app/views/projects/diffs/viewers/_mode_changed.html.haml b/app/views/projects/diffs/viewers/_mode_changed.html.haml index 69bc96bbdad..a8d6f5fe400 100644 --- a/app/views/projects/diffs/viewers/_mode_changed.html.haml +++ b/app/views/projects/diffs/viewers/_mode_changed.html.haml @@ -1,3 +1,3 @@ - diff_file = viewer.diff_file .nothing-here-block - File mode changed from #{diff_file.a_mode} to #{diff_file.b_mode} + = _("File mode changed from %{a_mode} to %{b_mode}") % { a_mode: diff_file.a_mode, b_mode: diff_file.b_mode } diff --git a/app/views/projects/diffs/viewers/_no_preview.html.haml b/app/views/projects/diffs/viewers/_no_preview.html.haml index befe070af2b..b763ac34bf8 100644 --- a/app/views/projects/diffs/viewers/_no_preview.html.haml +++ b/app/views/projects/diffs/viewers/_no_preview.html.haml @@ -1,2 +1,2 @@ .nothing-here-block - No preview for this file type + = _("No preview for this file type") diff --git a/app/views/projects/diffs/viewers/_not_diffable.html.haml b/app/views/projects/diffs/viewers/_not_diffable.html.haml index b2c677ec59c..7c55e272f56 100644 --- a/app/views/projects/diffs/viewers/_not_diffable.html.haml +++ b/app/views/projects/diffs/viewers/_not_diffable.html.haml @@ -1,2 +1,2 @@ .nothing-here-block - This diff was suppressed by a .gitattributes entry. + = _("This diff was suppressed by a .gitattributes entry.") diff --git a/app/views/projects/diffs/viewers/_renamed.html.haml b/app/views/projects/diffs/viewers/_renamed.html.haml index ef05ee38d8d..b7336c356fe 100644 --- a/app/views/projects/diffs/viewers/_renamed.html.haml +++ b/app/views/projects/diffs/viewers/_renamed.html.haml @@ -1,2 +1,2 @@ .nothing-here-block - File moved + = _("File moved") -- cgit v1.2.3