Make branches page translatable

This commit is contained in:
Winnie Hellmann 2017-09-22 16:01:20 +00:00 committed by Phil Hughes
parent f9df0e13e3
commit 920c0de564
4 changed files with 79 additions and 66 deletions

View File

@ -79,111 +79,111 @@ module SortingHelper
end
def sort_title_priority
'Priority'
s_('SortOptions|Priority')
end
def sort_title_label_priority
'Label priority'
s_('SortOptions|Label priority')
end
def sort_title_oldest_updated
'Oldest updated'
s_('SortOptions|Oldest updated')
end
def sort_title_recently_updated
'Last updated'
s_('SortOptions|Last updated')
end
def sort_title_oldest_activity
'Oldest updated'
s_('SortOptions|Oldest updated')
end
def sort_title_latest_activity
'Last updated'
s_('SortOptions|Last updated')
end
def sort_title_oldest_created
'Oldest created'
s_('SortOptions|Oldest created')
end
def sort_title_recently_created
'Last created'
s_('SortOptions|Last created')
end
def sort_title_milestone_soon
'Milestone due soon'
s_('SortOptions|Milestone due soon')
end
def sort_title_milestone_later
'Milestone due later'
s_('SortOptions|Milestone due later')
end
def sort_title_due_date_soon
'Due soon'
s_('SortOptions|Due soon')
end
def sort_title_due_date_later
'Due later'
s_('SortOptions|Due later')
end
def sort_title_start_date_soon
'Start soon'
s_('SortOptions|Start soon')
end
def sort_title_start_date_later
'Start later'
s_('SortOptions|Start later')
end
def sort_title_name
'Name'
s_('SortOptions|Name')
end
def sort_title_largest_repo
'Largest repository'
s_('SortOptions|Largest repository')
end
def sort_title_largest_group
'Largest group'
s_('SortOptions|Largest group')
end
def sort_title_recently_signin
'Recent sign in'
s_('SortOptions|Recent sign in')
end
def sort_title_oldest_signin
'Oldest sign in'
s_('SortOptions|Oldest sign in')
end
def sort_title_downvotes
'Least popular'
s_('SortOptions|Least popular')
end
def sort_title_upvotes
'Most popular'
s_('SortOptions|Most popular')
end
def sort_title_last_joined
'Last joined'
s_('SortOptions|Last joined')
end
def sort_title_oldest_joined
'Oldest joined'
s_('SortOptions|Oldest joined')
end
def sort_title_access_level_asc
'Access level, ascending'
s_('SortOptions|Access level, ascending')
end
def sort_title_access_level_desc
'Access level, descending'
s_('SortOptions|Access level, descending')
end
def sort_title_name_asc
'Name, ascending'
s_('SortOptions|Name, ascending')
end
def sort_title_name_desc
'Name, descending'
s_('SortOptions|Name, descending')
end
def sort_value_last_joined

View File

@ -13,20 +13,23 @@
- if branch.name == @repository.root_ref
%span.label.label-primary default
- elsif @repository.merged_to_root_ref? branch.name
%span.label.label-info.has-tooltip{ title: "Merged into #{@repository.root_ref}" }
merged
%span.label.label-info.has-tooltip{ title: s_('Branches|Merged into %{default_branch}') % { default_branch: @repository.root_ref } }
= s_('Branches|merged')
- if protected_branch?(@project, branch)
%span.label.label-success
protected
= s_('Branches|protected')
.controls.hidden-xs<
- if merge_project && create_mr_button?(@repository.root_ref, branch.name)
= link_to create_mr_path(@repository.root_ref, branch.name), class: 'btn btn-default' do
Merge request
= _('Merge request')
- if branch.name != @repository.root_ref
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: branch.name), class: "btn btn-default #{'prepend-left-10' unless merge_project}", method: :post, title: "Compare" do
Compare
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: branch.name),
class: "btn btn-default #{'prepend-left-10' unless merge_project}",
method: :post,
title: s_('Branches|Compare') do
= s_('Branches|Compare')
= render 'projects/buttons/download', project: @project, ref: branch.name, pipeline: @refs_pipelines[branch.name]
@ -34,12 +37,12 @@
- if branch.name == @project.repository.root_ref
%button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip disabled",
disabled: true,
title: "The default branch cannot be deleted" }
title: s_('Branches|The default branch cannot be deleted') }
= icon("trash-o")
- elsif protected_branch?(@project, branch)
- if can?(current_user, :delete_protected_branch, @project)
%button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip",
title: "Delete protected branch",
title: s_('Branches|Delete protected branch'),
data: { toggle: "modal",
target: "#modal-delete-branch",
delete_path: project_branch_path(@project, branch.name),
@ -49,20 +52,22 @@
- else
%button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip disabled",
disabled: true,
title: "Only a project master or owner can delete a protected branch" }
title: s_('Branches|Only a project master or owner can delete a protected branch') }
= icon("trash-o")
- else
= link_to project_branch_path(@project, branch.name),
class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip",
title: "Delete branch",
title: s_('Branches|Delete branch'),
method: :delete,
data: { confirm: "Deleting the '#{branch.name}' branch cannot be undone. Are you sure?" },
data: { confirm: s_("Branches|Deleting the '%{branch_name}' branch cannot be undone. Are you sure?") % { branch_name: branch.name } },
remote: true,
"aria-label" => "Delete branch" do
'aria-label' => s_('Branches|Delete branch') do
= icon("trash-o")
- if branch.name != @repository.root_ref
.divergence-graph{ title: "#{number_commits_behind} commits behind #{@repository.root_ref}, #{number_commits_ahead} commits ahead" }
.divergence-graph{ title: s_('%{number_commits_behind} commits behind %{default_branch}, %{number_commits_ahead} commits ahead') % { number_commits_behind: number_commits_behind,
default_branch: @repository.root_ref,
number_commits_ahead: number_commits_ahead } }
.graph-side
.bar.bar-behind{ style: "width: #{number_commits_behind * bar_graph_width_factor}%" }
%span.count.count-behind= number_commits_behind
@ -76,4 +81,4 @@
= render 'projects/branches/commit', commit: commit, project: @project
- else
%p
Cant find HEAD commit for this branch
= s_('Branches|Cant find HEAD commit for this branch')

View File

@ -4,36 +4,38 @@
.modal-header
%button.close{ data: { dismiss: 'modal' } } ×
%h3.page-title
Delete protected branch
= surround "'", "'?" do
- title_branch_name = capture do
%span.js-branch-name.ref-name>[branch name]
= s_("Branches|Delete protected branch '%{branch_name}'?").html_safe % { branch_name: title_branch_name }
.modal-body
%p
Youre about to permanently delete the protected branch
= succeed '.' do
%strong.js-branch-name.ref-name [branch name]
- branch_name = capture do
%strong.js-branch-name.ref-name>[branch name]
= s_('Branches|Youre about to permanently delete the protected branch %{branch_name}.').html_safe % { branch_name: branch_name }
%p.js-not-merged
- default_branch = capture do
%span.ref-name= @repository.root_ref
= s_("Branches|This branch hasnt been merged into %{default_branch}.").html_safe % { default_branch: default_branch }
= s_("Branches|To avoid data loss, consider merging this branch before deleting it.")
= s_('Branches|This branch hasnt been merged into %{default_branch}.').html_safe % { default_branch: default_branch }
= s_('Branches|To avoid data loss, consider merging this branch before deleting it.')
%p
Once you confirm and press
= succeed ',' do
%strong Delete protected branch
it cannot be undone or recovered.
- delete_protected_branch = capture do
%strong
= s_('Branches|Delete protected branch')
= s_('Branches|Once you confirm and press %{delete_protected_branch}, it cannot be undone or recovered.').html_safe % { delete_protected_branch: delete_protected_branch }
%p
%strong To confirm, type
%kbd.js-branch-name [branch name]
- branch_name_confirmation = capture do
%kbd.js-branch-name [branch name]
%strong
= s_('Branches|To confirm, type %{branch_name_confirmation}:').html_safe % { branch_name_confirmation: branch_name_confirmation }
.form-group
= text_field_tag 'delete_branch_input', '', class: 'form-control js-delete-branch-input'
.modal-footer
%button.btn{ data: { dismiss: 'modal' } } Cancel
= link_to 'Delete protected branch', '',
= link_to s_('Branches|Delete protected branch'), '',
class: "btn btn-danger js-delete-branch",
title: 'Delete branch',
title: s_('Branches|Delete branch'),
method: :delete,
"aria-label" => "Delete"
'aria-label' => s_('Branches|Delete branch')

View File

@ -1,17 +1,17 @@
- @no_container = true
- page_title "Branches"
- page_title _('Branches')
= render "projects/commits/head"
%div{ class: container_class }
.top-area.adjust
- if can?(current_user, :admin_project, @project)
.nav-text
Protected branches can be managed in
= link_to 'project settings', project_protected_branches_path(@project)
- project_settings_link = link_to s_('Branches|project settings'), project_protected_branches_path(@project)
= s_('Branches|Protected branches can be managed in %{project_settings_link}').html_safe % { project_settings_link: project_settings_link }
.nav-controls
= form_tag(filter_branches_path, method: :get) do
= search_field_tag :search, params[:search], { placeholder: 'Filter by branch name', id: 'branch-search', class: 'form-control search-text-input input-short', spellcheck: false }
= search_field_tag :search, params[:search], { placeholder: s_('Branches|Filter by branch name'), id: 'branch-search', class: 'form-control search-text-input input-short', spellcheck: false }
.dropdown.inline>
%button.dropdown-menu-toggle{ type: 'button', 'data-toggle' => 'dropdown' }
@ -20,16 +20,21 @@
= icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable
%li.dropdown-header
Sort by
= s_('Branches|Sort by')
- branches_sort_options_hash.each do |value, title|
%li
= link_to title, filter_branches_path(sort: value), class: ("is-active" if @sort == value)
- if can? current_user, :push_code, @project
= link_to project_merged_branches_path(@project), class: 'btn btn-inverted btn-remove has-tooltip', title: "Delete all branches that are merged into '#{@project.repository.root_ref}'", method: :delete, data: { confirm: "Deleting the merged branches cannot be undone. Are you sure?", container: 'body' } do
Delete merged branches
= link_to project_merged_branches_path(@project),
class: 'btn btn-inverted btn-remove has-tooltip',
title: s_("Branches|Delete all branches that are merged into '%{default_branch}'") % { default_branch: @project.repository.root_ref },
method: :delete,
data: { confirm: s_('Branches|Deleting the merged branches cannot be undone. Are you sure?'),
container: 'body' } do
= s_('Branches|Delete merged branches')
= link_to new_project_branch_path(@project), class: 'btn btn-create' do
New branch
= s_('Branches|New branch')
- if @branches.any?
%ul.content-list.all-branches
@ -37,6 +42,7 @@
= render "projects/branches/branch", branch: branch
= paginate @branches, theme: 'gitlab'
- else
.nothing-here-block No branches to show
.nothing-here-block
= s_('Branches|No branches to show')
= render 'projects/branches/delete_protected_modal'