From 892de12db0ff6b66a19317abd48ae918bf3a0879 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Thu, 2 Nov 2017 16:30:06 -0600 Subject: [PATCH 1/2] Internationalized the tags page --- app/views/projects/tags/_tag.html.haml | 8 ++++---- app/views/projects/tags/index.html.haml | 14 +++++++------- app/views/projects/tags/new.html.haml | 15 +++++++++------ app/views/projects/tags/show.html.haml | 18 +++++++++--------- .../38589-internationalize-tags-page.yml | 5 +++++ 5 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 changelogs/unreleased/38589-internationalize-tags-page.yml diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml index 1927216e191..9548b4688d6 100644 --- a/app/views/projects/tags/_tag.html.haml +++ b/app/views/projects/tags/_tag.html.haml @@ -7,7 +7,7 @@ - if protected_tag?(@project, tag) %span.label.label-success.prepend-left-4 - protected + = s_('TagsPage|protected') - if tag.message.present?   @@ -18,7 +18,7 @@ = render 'projects/branches/commit', commit: commit, project: @project - else %p - Cant find HEAD commit for this tag + = s_('TagsPage|Cannot find HEAD commit for this tag') - if release && release.description.present? .description.prepend-top-default .wiki @@ -28,9 +28,9 @@ = render 'projects/buttons/download', project: @project, ref: tag.name, pipeline: @tags_pipelines[tag.name] - if can?(current_user, :push_code, @project) - = link_to edit_project_tag_release_path(@project, tag.name), class: 'btn has-tooltip', title: "Edit release notes", data: { container: "body" } do + = link_to edit_project_tag_release_path(@project, tag.name), class: 'btn has-tooltip', title: s_('TagsPage|Edit release notes'), data: { container: "body" } do = icon("pencil") - if can?(current_user, :admin_project, @project) - = link_to project_tag_path(@project, tag.name), class: "btn btn-remove remove-row has-tooltip #{protected_tag?(@project, tag) ? 'disabled' : ''}", title: "Delete tag", method: :delete, data: { confirm: "Deleting the '#{tag.name}' tag cannot be undone. Are you sure?", container: 'body' }, remote: true do + = link_to project_tag_path(@project, tag.name), class: "btn btn-remove remove-row has-tooltip #{protected_tag?(@project, tag) ? 'disabled' : ''}", title: s_('TagsPage|Delete tag'), method: :delete, data: { confirm: s_('TagsPage|Deleting the %{tag_name} tag cannot be undone. Are you sure?') % { tag_name: tag.name }, container: 'body' }, remote: true do = icon("trash-o") diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml index 27d58d4c0e8..b78a0efa585 100644 --- a/app/views/projects/tags/index.html.haml +++ b/app/views/projects/tags/index.html.haml @@ -1,16 +1,16 @@ - @no_container = true - @sort ||= sort_value_recently_updated -- page_title "Tags" +- page_title _('Tags') - add_to_breadcrumbs("Repository", project_tree_path(@project)) .flex-list{ class: container_class } .top-area.adjust .nav-text.row-main-content - Tags give the ability to mark specific points in history as being important + = s_('TagsPage|Tags give the ability to mark specific points in history as being important') .nav-controls.row-fixed-content = form_tag(filter_tags_path, method: :get) do - = search_field_tag :search, params[:search], { placeholder: 'Filter by tag name', id: 'tag-search', class: 'form-control search-text-input input-short', spellcheck: false } + = search_field_tag :search, params[:search], { placeholder: s_('TagsPage|Filter by tag name'), id: 'tag-search', class: 'form-control search-text-input input-short', spellcheck: false } .dropdown %button.dropdown-toggle{ type: 'button', data: { toggle: 'dropdown'} } @@ -19,13 +19,13 @@ = icon('chevron-down') %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable %li.dropdown-header - Sort by + = s_('TagsPage|Sort by') - tags_sort_options_hash.each do |value, title| %li = link_to title, filter_tags_path(sort: value), class: ("is-active" if @sort == value) - if can?(current_user, :push_code, @project) = link_to new_project_tag_path(@project), class: 'btn btn-create new-tag-btn' do - New tag + = s_('TagsPage|New tag') .tags - if @tags.any? @@ -36,9 +36,9 @@ - else .nothing-here-block - Repository has no tags yet. + = s_('TagsPage|Repository has no tags yet.') %br %small - Use git tag command to add a new one: + = s_('TagsPage|Use git tag command to add a new one:') %br %span.monospace git tag -a v1.4 -m 'version 1.4' diff --git a/app/views/projects/tags/new.html.haml b/app/views/projects/tags/new.html.haml index 521b4d927bc..3e99e0e8234 100644 --- a/app/views/projects/tags/new.html.haml +++ b/app/views/projects/tags/new.html.haml @@ -1,4 +1,4 @@ -- page_title "New Tag" +- page_title s_('TagsPage|New Tag') - default_ref = params[:ref] || @project.default_branch - if @error @@ -7,7 +7,7 @@ = @error %h3.page-title - New Tag + = s_('TagsPage|New Tag') %hr = form_tag namespace_project_tags_path, method: :post, id: "new-tag-form", class: "form-horizontal common-note-form tag-form js-quick-submit js-requires-input" do @@ -23,20 +23,23 @@ = button_tag type: 'button', title: default_ref, class: 'dropdown-menu-toggle wide form-control js-branch-select', required: true, data: { toggle: 'dropdown', selected: default_ref, field_name: 'ref' } do .text-left.dropdown-toggle-text= default_ref = render 'shared/ref_dropdown', dropdown_class: 'wide' - .help-block Existing branch name, tag, or commit SHA + .help-block + = s_('TagsPage|Existing branch name, tag, or commit SHA') .form-group = label_tag :message, nil, class: 'control-label' .col-sm-10 = text_area_tag :message, @message, required: false, tabindex: 3, class: 'form-control', rows: 5 - .help-block Optionally, add a message to the tag. + .help-block + = s_('TagsPage|Optionally, add a message to the tag.') %hr .form-group = label_tag :release_description, 'Release notes', class: 'control-label' .col-sm-10 = render layout: 'projects/md_preview', locals: { url: preview_markdown_path(@project), referenced_users: true } do - = render 'projects/zen', attr: :release_description, classes: 'note-textarea', placeholder: "Write your release notes or drag files here...", current_text: @release_description + = render 'projects/zen', attr: :release_description, classes: 'note-textarea', placeholder: s_('TagsPage|Write your release notes or drag files here...'), current_text: @release_description = render 'shared/notes/hints' - .help-block Optionally, add release notes to the tag. They will be stored in the GitLab database and displayed on the tags page. + .help-block + = s_('TagsPage|Optionally, add release notes to the tag. They will be stored in the GitLab database and displayed on the tags page.') .form-actions = button_tag 'Create tag', class: 'btn btn-create', tabindex: 3 = link_to 'Cancel', project_tags_path(@project), class: 'btn btn-cancel' diff --git a/app/views/projects/tags/show.html.haml b/app/views/projects/tags/show.html.haml index 43aa2b27af6..04b1c88842d 100644 --- a/app/views/projects/tags/show.html.haml +++ b/app/views/projects/tags/show.html.haml @@ -1,7 +1,7 @@ - @no_container = true -- add_to_breadcrumbs "Tags", project_tags_path(@project) +- add_to_breadcrumbs s_('TagsPage|Tags'), project_tags_path(@project) - breadcrumb_title @tag.name -- page_title @tag.name, "Tags" +- page_title @tag.name, s_('TagsPage|Tags') %div{ class: container_class } .top-area.multi-line @@ -12,25 +12,25 @@ = @tag.name - if protected_tag?(@project, @tag) %span.label.label-success - protected + = s_('TagsPage|protected') - if @commit = render 'projects/branches/commit', commit: @commit, project: @project - else - Cant find HEAD commit for this tag + = s_('TagsPage|Cannot find HEAD commit for this tag') .nav-controls.controls-flex - if can?(current_user, :push_code, @project) - = link_to edit_project_tag_release_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: 'Edit release notes' do + = link_to edit_project_tag_release_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: s_('TagsPage|Edit release notes') do = icon("pencil") - = link_to project_tree_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: 'Browse files' do + = link_to project_tree_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: s_('TagsPage|Browse files') do = icon('files-o') - = link_to project_commits_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: 'Browse commits' do + = link_to project_commits_path(@project, @tag.name), class: 'btn controls-item has-tooltip', title: s_('TagsPage|Browse commits') do = icon('history') .btn-container.controls-item = render 'projects/buttons/download', project: @project, ref: @tag.name - if can?(current_user, :admin_project, @project) .btn-container.controls-item-full - = link_to project_tag_path(@project, @tag.name), class: "btn btn-remove remove-row has-tooltip #{protected_tag?(@project, @tag) ? 'disabled' : ''}", title: "Delete tag", method: :delete, data: { confirm: "Deleting the '#{@tag.name}' tag cannot be undone. Are you sure?" } do + = link_to project_tag_path(@project, @tag.name), class: "btn btn-remove remove-row has-tooltip #{protected_tag?(@project, @tag) ? 'disabled' : ''}", title: s_('TagsPage|Delete tag'), method: :delete, data: { confirm: s_('TagsPage|Deleting the %{tag_name} tag cannot be undone. Are you sure?') % { tag_name: @tag.name } } do %i.fa.fa-trash-o - if @tag.message.present? @@ -43,4 +43,4 @@ .wiki = markdown_field(@release, :description) - else - This tag has no release notes. + = s_('TagsPage|This tag has no release notes.') diff --git a/changelogs/unreleased/38589-internationalize-tags-page.yml b/changelogs/unreleased/38589-internationalize-tags-page.yml new file mode 100644 index 00000000000..4af3da8c23c --- /dev/null +++ b/changelogs/unreleased/38589-internationalize-tags-page.yml @@ -0,0 +1,5 @@ +--- +title: Internationalized tags page +merge_request: 38589 +author: +type: other From 21ec0b14139f01074f74cb2cce1ceeeba579a773 Mon Sep 17 00:00:00 2001 From: Jose Ivan Vargas Date: Mon, 6 Nov 2017 09:49:41 -0600 Subject: [PATCH 2/2] consistency fixes --- app/views/projects/tags/_tag.html.haml | 2 +- app/views/projects/tags/index.html.haml | 2 +- app/views/projects/tags/show.html.haml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml index 9548b4688d6..467f19b4c56 100644 --- a/app/views/projects/tags/_tag.html.haml +++ b/app/views/projects/tags/_tag.html.haml @@ -18,7 +18,7 @@ = render 'projects/branches/commit', commit: commit, project: @project - else %p - = s_('TagsPage|Cannot find HEAD commit for this tag') + = s_("TagsPage|Can't find HEAD commit for this tag") - if release && release.description.present? .description.prepend-top-default .wiki diff --git a/app/views/projects/tags/index.html.haml b/app/views/projects/tags/index.html.haml index b78a0efa585..fd3b8c01b83 100644 --- a/app/views/projects/tags/index.html.haml +++ b/app/views/projects/tags/index.html.haml @@ -1,6 +1,6 @@ - @no_container = true - @sort ||= sort_value_recently_updated -- page_title _('Tags') +- page_title _('TagsPage|Tags') - add_to_breadcrumbs("Repository", project_tree_path(@project)) .flex-list{ class: container_class } diff --git a/app/views/projects/tags/show.html.haml b/app/views/projects/tags/show.html.haml index 04b1c88842d..dfe2c37ed8e 100644 --- a/app/views/projects/tags/show.html.haml +++ b/app/views/projects/tags/show.html.haml @@ -16,7 +16,7 @@ - if @commit = render 'projects/branches/commit', commit: @commit, project: @project - else - = s_('TagsPage|Cannot find HEAD commit for this tag') + = s_("TagsPage|Can't find HEAD commit for this tag") .nav-controls.controls-flex - if can?(current_user, :push_code, @project)