From 8b0ceed6766d3ea7c18b0353fc682767a41459b1 Mon Sep 17 00:00:00 2001 From: Tao Wang Date: Thu, 14 Jun 2018 18:13:27 +1000 Subject: [PATCH] i18n: externalize strings from 'app/views/projects/protected_branches' Signed-off-by: Tao Wang --- .../_create_protected_branch.html.haml | 4 +- .../_update_protected_branch.html.haml | 4 +- .../shared/_branches_list.html.haml | 12 +-- .../shared/_create_protected_branch.html.haml | 18 ++-- .../shared/_dropdown.html.haml | 8 +- .../shared/_index.html.haml | 21 ++-- .../shared/_protected_branch.html.haml | 4 +- .../protected_branches/show.html.haml | 10 +- locale/gitlab.pot | 96 +++++++++++++++++++ 9 files changed, 136 insertions(+), 41 deletions(-) diff --git a/app/views/projects/protected_branches/_create_protected_branch.html.haml b/app/views/projects/protected_branches/_create_protected_branch.html.haml index 24b53555cdcfcb..fe1242389b4d11 100644 --- a/app/views/projects/protected_branches/_create_protected_branch.html.haml +++ b/app/views/projects/protected_branches/_create_protected_branch.html.haml @@ -1,12 +1,12 @@ - content_for :merge_access_levels do .merge_access_levels-container - = dropdown_tag('Select', + = dropdown_tag(_('Select'), options: { toggle_class: 'js-allowed-to-merge qa-allowed-to-merge-select wide', dropdown_class: 'dropdown-menu-selectable qa-allowed-to-merge-dropdown capitalize-header', data: { field_name: 'protected_branch[merge_access_levels_attributes][0][access_level]', input_id: 'merge_access_levels_attributes' }}) - content_for :push_access_levels do .push_access_levels-container - = dropdown_tag('Select', + = dropdown_tag(_('Select'), options: { toggle_class: 'js-allowed-to-push qa-allowed-to-push-select wide', dropdown_class: 'dropdown-menu-selectable qa-allowed-to-push-dropdown capitalize-header', data: { field_name: 'protected_branch[push_access_levels_attributes][0][access_level]', input_id: 'push_access_levels_attributes' }}) diff --git a/app/views/projects/protected_branches/_update_protected_branch.html.haml b/app/views/projects/protected_branches/_update_protected_branch.html.haml index 74bfaa9ff80f2e..47c9bc56f650d8 100644 --- a/app/views/projects/protected_branches/_update_protected_branch.html.haml +++ b/app/views/projects/protected_branches/_update_protected_branch.html.haml @@ -1,10 +1,10 @@ %td = hidden_field_tag "allowed_to_merge_#{protected_branch.id}", protected_branch.merge_access_levels.first.access_level - = dropdown_tag( (protected_branch.merge_access_levels.first.humanize || 'Select') , + = dropdown_tag( (protected_branch.merge_access_levels.first.humanize || _('Select')) , options: { toggle_class: 'js-allowed-to-merge qa-allowed-to-merge', dropdown_class: 'dropdown-menu-selectable js-allowed-to-merge-container capitalize-header', data: { field_name: "allowed_to_merge_#{protected_branch.id}", access_level_id: protected_branch.merge_access_levels.first.id }}) %td = hidden_field_tag "allowed_to_push_#{protected_branch.id}", protected_branch.push_access_levels.first.access_level - = dropdown_tag( (protected_branch.push_access_levels.first.humanize || 'Select') , + = dropdown_tag( (protected_branch.push_access_levels.first.humanize || _('Select')) , options: { toggle_class: 'js-allowed-to-push', dropdown_class: 'dropdown-menu-selectable js-allowed-to-push-container capitalize-header', data: { field_name: "allowed_to_push_#{protected_branch.id}", access_level_id: protected_branch.push_access_levels.first.id }}) diff --git a/app/views/projects/protected_branches/shared/_branches_list.html.haml b/app/views/projects/protected_branches/shared/_branches_list.html.haml index 9a06eca89bb66b..7e714c188f504f 100644 --- a/app/views/projects/protected_branches/shared/_branches_list.html.haml +++ b/app/views/projects/protected_branches/shared/_branches_list.html.haml @@ -2,9 +2,9 @@ - if @protected_branches.empty? .card-header.bg-white %h3.card-title.mb-0 - Protected branch (#{@protected_branches_count}) + #{ _("Protected branch") } (#{@protected_branches_count}) %p.settings-message.text-center - There are currently no protected branches, protect a branch with the form above. + = _("There are currently no protected branches, protect a branch with the form above.") - else %table.table.table-bordered %colgroup @@ -16,10 +16,10 @@ %col %thead %tr - %th Protected branch (#{@protected_branches_count}) - %th Last commit - %th Allowed to merge - %th Allowed to push + %th= _('Protected branch (%{protected_branches_count})') % { protected_branches_count: @protected_branches_count } + %th= _('Last commit') + %th= _('Allowed to merge') + %th= _('Allowed to push') - if can_admin_project %th %tbody diff --git a/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml b/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml index c2d6c034e357d6..aba53e9fce5608 100644 --- a/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml +++ b/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml @@ -2,31 +2,27 @@ .card .card-header %h3.card-title - Protect a branch + = _("Protect a branch") .card-body = form_errors(@protected_branch) .form-group.row = f.label :name, class: 'col-md-2 text-right' do - Branch: + = _("Branch:") .col-md-10 = render partial: "projects/protected_branches/shared/dropdown", locals: { f: f } .form-text.text-muted - = link_to 'Wildcards', help_page_path('user/project/protected_branches', anchor: 'wildcard-protected-branches') - such as - %code *-stable - or - %code production/* - are supported + - link_to_wildcard = link_to(_('Wildcards'), help_page_path('user/project/protected_branches', anchor: 'wildcard-protected-branches')) + = _("such as *-stable or production/* are supported").html_safe .form-group.row %label.col-md-2.text-right{ for: 'merge_access_levels_attributes' } - Allowed to merge: + = _("Allowed to merge:") .col-md-10 = yield :merge_access_levels .form-group.row %label.col-md-2.text-right{ for: 'push_access_levels_attributes' } - Allowed to push: + = _("Allowed to push:") .col-md-10 = yield :push_access_levels .card-footer - = f.submit 'Protect', class: 'btn-create btn', disabled: true + = f.submit _('Protect'), class: 'btn-create btn', disabled: true diff --git a/app/views/projects/protected_branches/shared/_dropdown.html.haml b/app/views/projects/protected_branches/shared/_dropdown.html.haml index b3d6068039a348..375c14b5e03097 100644 --- a/app/views/projects/protected_branches/shared/_dropdown.html.haml +++ b/app/views/projects/protected_branches/shared/_dropdown.html.haml @@ -1,8 +1,8 @@ = f.hidden_field(:name) -= dropdown_tag('Select branch or create wildcard', += dropdown_tag(_('Select branch or create wildcard'), options: { toggle_class: 'js-protected-branch-select js-filter-submit wide git-revision-dropdown-toggle qa-protected-branch-select', - filter: true, dropdown_class: "dropdown-menu-selectable git-revision-dropdown qa-protected-branch-dropdown", placeholder: "Search protected branches", + filter: true, dropdown_class: "dropdown-menu-selectable git-revision-dropdown qa-protected-branch-dropdown", placeholder: _("Search protected branches"), footer_content: true, data: { show_no: true, show_any: true, show_upcoming: true, selected: params[:protected_branch_name], @@ -10,6 +10,6 @@ %ul.dropdown-footer-list %li - %button{ class: "dropdown-create-new-item-button js-dropdown-create-new-item", title: "New Protected Branch" } - Create wildcard + %button{ class: "dropdown-create-new-item-button js-dropdown-create-new-item", title: _("New Protected Branch") } + = _("Create wildcard") %code diff --git a/app/views/projects/protected_branches/shared/_index.html.haml b/app/views/projects/protected_branches/shared/_index.html.haml index 4f1c6c92484cfb..76b564cad166eb 100644 --- a/app/views/projects/protected_branches/shared/_index.html.haml +++ b/app/views/projects/protected_branches/shared/_index.html.haml @@ -3,20 +3,23 @@ %section.qa-protected-branches-settings.settings.no-animate{ class: ('expanded' if expanded) } .settings-header %h4 - Protected Branches + = _("Protected Branches") %button.btn.js-settings-toggle.qa-expand-protected-branches{ type: 'button' } - = expanded ? 'Collapse' : 'Expand' + = expanded ? _('Collapse') : _('Expand') %p - Keep stable branches secure and force developers to use merge requests. + = _("Keep stable branches secure and force developers to use merge requests.") .settings-content %p - By default, protected branches are designed to: + = _("By default, protected branches are designed to:") %ul - %li prevent their creation, if not already created, from everybody except Maintainers - %li prevent pushes from everybody except Maintainers - %li prevent anyone from force pushing to the branch - %li prevent anyone from deleting the branch - %p Read more about #{link_to "protected branches", help_page_path("user/project/protected_branches")} and #{link_to "project permissions", help_page_path("user/permissions")}. + %li= _("prevent their creation, if not already created, from everybody except Maintainers") + %li= _("prevent pushes from everybody except Maintainers") + %li= _("prevent anyone from force pushing to the branch").html_safe + %li= _("prevent anyone from deleting the branch").html_safe + %p + - link_to_protected_branches = link_to(_("protected branches"), help_page_path("user/project/protected_branches")) + - link_to_project_permissions = link_to(_("project permissions"), help_page_path("user/permissions")) + = _("Read more about %{link_to_protected_branches} and %{link_to_project_permissions}.").html_safe % { link_to_protected_branches: link_to_protected_branches, link_to_project_permissions: link_to_project_permissions } - if can? current_user, :admin_project, @project = content_for :create_protected_branch diff --git a/app/views/projects/protected_branches/shared/_protected_branch.html.haml b/app/views/projects/protected_branches/shared/_protected_branch.html.haml index 05cee483c0eb19..1896dca8c92d8b 100644 --- a/app/views/projects/protected_branches/shared/_protected_branch.html.haml +++ b/app/views/projects/protected_branches/shared/_protected_branch.html.haml @@ -15,10 +15,10 @@ = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit-sha') = time_ago_with_tooltip(commit.committed_date) - else - (branch was removed from repository) + = _("(branch was removed from repository)") = yield - if can_admin_project %td - = link_to 'Unprotect', [@project.namespace.becomes(Namespace), @project, protected_branch], disabled: local_assigns[:disabled], data: { confirm: 'Branch will be writable for developers. Are you sure?' }, method: :delete, class: "btn btn-warning" + = link_to _('Unprotect'), [@project.namespace.becomes(Namespace), @project, protected_branch], disabled: local_assigns[:disabled], data: { confirm: _('Branch will be writable for developers. Are you sure?') }, method: :delete, class: "btn btn-warning" diff --git a/app/views/projects/protected_branches/show.html.haml b/app/views/projects/protected_branches/show.html.haml index 7ccbcfded203bf..8c0d6158a7084a 100644 --- a/app/views/projects/protected_branches/show.html.haml +++ b/app/views/projects/protected_branches/show.html.haml @@ -1,4 +1,4 @@ -- page_title @protected_ref.name, "Protected Branches" +- page_title @protected_ref.name, _("Protected Branches") .row.prepend-top-default.append-bottom-default .col-lg-3 @@ -6,7 +6,7 @@ = @protected_ref.name .col-lg-9.edit_protected_branch - %h5 Matching Branches + %h5= _("Matching Branches") - if @matching_refs.present? .table-responsive %table.table.protected-branches-list @@ -15,11 +15,11 @@ %col{ width: "30%" } %thead %tr - %th Branch - %th Last commit + %th= _('Branch') + %th= _('Last commit') %tbody - @matching_refs.each do |matching_branch| = render partial: "projects/protected_branches/shared/matching_branch", object: matching_branch - else %p.settings-message.text-center - Couldn't find any matching branches. + = _("Couldn't find any matching branches.") diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 0ea8789d6cbfc5..89308dbbd6209d 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -188,6 +188,9 @@ msgstr[1] "" msgid "%{unstaged} unstaged and %{staged} staged changes" msgstr "" +msgid "(branch was removed from repository)" +msgstr "" + msgid "+ %{moreCount} more" msgstr "" @@ -522,6 +525,18 @@ msgstr "" msgid "Allow requests to the local network from hooks and services." msgstr "" +msgid "Allowed to merge" +msgstr "" + +msgid "Allowed to merge:" +msgstr "" + +msgid "Allowed to push" +msgstr "" + +msgid "Allowed to push:" +msgstr "" + msgid "Allows you to add and manage Kubernetes clusters." msgstr "" @@ -1056,6 +1071,9 @@ msgstr "" msgid "Boards" msgstr "" +msgid "Branch" +msgstr "" + msgid "Branch %{branchName} was not found in this project's repository." msgstr "" @@ -1076,6 +1094,12 @@ msgstr "" msgid "Branch name" msgstr "" +msgid "Branch will be writable for developers. Are you sure?" +msgstr "" + +msgid "Branch:" +msgstr "" + msgid "BranchSwitcherPlaceholder|Search branches" msgstr "" @@ -1223,6 +1247,9 @@ msgstr "" msgid "Business metrics (Custom)" msgstr "" +msgid "By default, protected branches are designed to:" +msgstr "" + msgid "ByAuthor|by" msgstr "" @@ -2223,6 +2250,9 @@ msgstr "" msgid "Copy token to clipboard" msgstr "" +msgid "Couldn't find any matching branches." +msgstr "" + msgid "Create" msgstr "" @@ -2298,6 +2328,9 @@ msgstr "" msgid "Create project label" msgstr "" +msgid "Create wildcard" +msgstr "" + msgid "CreateNewFork|Fork" msgstr "" @@ -4022,6 +4055,9 @@ msgstr "" msgid "June" msgstr "" +msgid "Keep stable branches secure and force developers to use merge requests." +msgstr "" + msgid "Koding" msgstr "" @@ -4344,6 +4380,9 @@ msgstr "" msgid "Markdown enabled" msgstr "" +msgid "Matching Branches" +msgstr "" + msgid "Maximum git storage failures" msgstr "" @@ -4679,6 +4718,9 @@ msgstr "" msgid "New Pipeline Schedule" msgstr "" +msgid "New Protected Branch" +msgstr "" + msgid "New Snippet" msgstr "" @@ -5683,6 +5725,21 @@ msgstr "" msgid "Promotions|Upgrade plan" msgstr "" +msgid "Protect" +msgstr "" + +msgid "Protect a branch" +msgstr "" + +msgid "Protected Branches" +msgstr "" + +msgid "Protected branch" +msgstr "" + +msgid "Protected branch (%{protected_branches_count})" +msgstr "" + msgid "Protip:" msgstr "" @@ -5737,6 +5794,9 @@ msgstr "" msgid "Read more" msgstr "" +msgid "Read more about %{link_to_protected_branches} and %{link_to_project_permissions}." +msgstr "" + msgid "Read more about project permissions %{link_to_help}" msgstr "" @@ -6065,6 +6125,9 @@ msgstr "" msgid "Search project" msgstr "" +msgid "Search protected branches" +msgstr "" + msgid "Search users" msgstr "" @@ -6142,6 +6205,9 @@ msgstr "" msgid "Select assignee" msgstr "" +msgid "Select branch or create wildcard" +msgstr "" + msgid "Select branch/tag" msgstr "" @@ -6830,6 +6896,9 @@ msgstr "" msgid "The value lying at the midpoint of a series of observed values. E.g., between 3, 5, 9, the median is 5. Between 3, 5, 7, 8, the median is (5+7)/2 = 6." msgstr "" +msgid "There are currently no protected branches, protect a branch with the form above." +msgstr "" + msgid "There are no issues to show" msgstr "" @@ -7317,6 +7386,9 @@ msgstr "" msgid "Unlocked" msgstr "" +msgid "Unprotect" +msgstr "" + msgid "Unresolve discussion" msgstr "" @@ -7689,6 +7761,9 @@ msgstr "" msgid "Wiki|Wiki Pages" msgstr "" +msgid "Wildcards" +msgstr "" + msgid "With contribution analytics you can have an overview for the activity of issues, merge requests and push events of your organization and its members." msgstr "" @@ -8459,9 +8534,27 @@ msgstr "" msgid "personal access token" msgstr "" +msgid "prevent anyone from deleting the branch" +msgstr "" + +msgid "prevent anyone from force pushing to the branch" +msgstr "" + +msgid "prevent pushes from everybody except Maintainers" +msgstr "" + +msgid "prevent their creation, if not already created, from everybody except Maintainers" +msgstr "" + msgid "private key does not match certificate." msgstr "" +msgid "project permissions" +msgstr "" + +msgid "protected branches" +msgstr "" + msgid "remaining" msgstr "" @@ -8480,6 +8573,9 @@ msgstr "" msgid "started" msgstr "" +msgid "such as *-stable or production/* are supported" +msgstr "" + msgid "this document" msgstr "" -- GitLab