Commit bff4f544 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Phil Hughes

Make branches page translatable

parent 9f80a23a
module MirrorHelper module MirrorHelper
def branch_diverged_tooltip_message def branch_diverged_tooltip_message
message = "The branch could not be updated automatically because it has diverged from its upstream counterpart." message = s_('Branches|The branch could not be updated automatically because it has diverged from its upstream counterpart.')
message << "<br>To discard the local changes and overwrite the branch with the upstream version, delete it here and choose 'Update Now' above." if can?(current_user, :push_code, @project)
if can?(current_user, :push_code, @project)
message << '<br>'
message << s_("Branches|To discard the local changes and overwrite the branch with the upstream version, delete it here and choose 'Update Now' above.")
end
message message
end end
......
...@@ -81,87 +81,87 @@ module SortingHelper ...@@ -81,87 +81,87 @@ module SortingHelper
end end
def sort_title_priority def sort_title_priority
'Priority' s_('SortOptions|Priority')
end end
def sort_title_label_priority def sort_title_label_priority
'Label priority' s_('SortOptions|Label priority')
end end
def sort_title_oldest_updated def sort_title_oldest_updated
'Oldest updated' s_('SortOptions|Oldest updated')
end end
def sort_title_recently_updated def sort_title_recently_updated
'Last updated' s_('SortOptions|Last updated')
end end
def sort_title_oldest_activity def sort_title_oldest_activity
'Oldest updated' s_('SortOptions|Oldest updated')
end end
def sort_title_latest_activity def sort_title_latest_activity
'Last updated' s_('SortOptions|Last updated')
end end
def sort_title_oldest_created def sort_title_oldest_created
'Oldest created' s_('SortOptions|Oldest created')
end end
def sort_title_recently_created def sort_title_recently_created
'Last created' s_('SortOptions|Last created')
end end
def sort_title_milestone_soon def sort_title_milestone_soon
'Milestone due soon' s_('SortOptions|Milestone due soon')
end end
def sort_title_milestone_later def sort_title_milestone_later
'Milestone due later' s_('SortOptions|Milestone due later')
end end
def sort_title_due_date_soon def sort_title_due_date_soon
'Due soon' s_('SortOptions|Due soon')
end end
def sort_title_due_date_later def sort_title_due_date_later
'Due later' s_('SortOptions|Due later')
end end
def sort_title_start_date_soon def sort_title_start_date_soon
'Start soon' s_('SortOptions|Start soon')
end end
def sort_title_start_date_later def sort_title_start_date_later
'Start later' s_('SortOptions|Start later')
end end
def sort_title_name def sort_title_name
'Name' s_('SortOptions|Name')
end end
def sort_title_largest_repo def sort_title_largest_repo
'Largest repository' s_('SortOptions|Largest repository')
end end
def sort_title_largest_group def sort_title_largest_group
'Largest group' s_('SortOptions|Largest group')
end end
def sort_title_recently_signin def sort_title_recently_signin
'Recent sign in' s_('SortOptions|Recent sign in')
end end
def sort_title_oldest_signin def sort_title_oldest_signin
'Oldest sign in' s_('SortOptions|Oldest sign in')
end end
def sort_title_downvotes def sort_title_downvotes
'Least popular' s_('SortOptions|Least popular')
end end
def sort_title_upvotes def sort_title_upvotes
'Most popular' s_('SortOptions|Most popular')
end end
def sort_title_more_weight def sort_title_more_weight
...@@ -173,27 +173,27 @@ module SortingHelper ...@@ -173,27 +173,27 @@ module SortingHelper
end end
def sort_title_last_joined def sort_title_last_joined
'Last joined' s_('SortOptions|Last joined')
end end
def sort_title_oldest_joined def sort_title_oldest_joined
'Oldest joined' s_('SortOptions|Oldest joined')
end end
def sort_title_access_level_asc def sort_title_access_level_asc
'Access level, ascending' s_('SortOptions|Access level, ascending')
end end
def sort_title_access_level_desc def sort_title_access_level_desc
'Access level, descending' s_('SortOptions|Access level, descending')
end end
def sort_title_name_asc def sort_title_name_asc
'Name, ascending' s_('SortOptions|Name, ascending')
end end
def sort_title_name_desc def sort_title_name_desc
'Name, descending' s_('SortOptions|Name, descending')
end end
def sort_value_last_joined def sort_value_last_joined
......
...@@ -13,26 +13,29 @@ ...@@ -13,26 +13,29 @@
- if branch.name == @repository.root_ref - if branch.name == @repository.root_ref
%span.label.label-primary default %span.label.label-primary default
- elsif @repository.merged_to_root_ref? branch.name - elsif @repository.merged_to_root_ref? branch.name
%span.label.label-info.has-tooltip{ title: "Merged into #{@repository.root_ref}" } %span.label.label-info.has-tooltip{ title: s_('Branches|Merged into %{default_branch}') % { default_branch: @repository.root_ref } }
merged = s_('Branches|merged')
- if protected_branch?(@project, branch) - if protected_branch?(@project, branch)
%span.label.label-success %span.label.label-success
protected = s_('Branches|protected')
- if @project.mirror_ever_updated_successfully? && @repository.diverged_from_upstream?(branch.name) - if @project.mirror_ever_updated_successfully? && @repository.diverged_from_upstream?(branch.name)
%span.label.label-danger.has-tooltip{ data: { html: "true", title: branch_diverged_tooltip_message } } %span.label.label-danger.has-tooltip{ data: { html: "true", title: branch_diverged_tooltip_message } }
= icon('exclamation-triangle') = icon('exclamation-triangle')
diverged from upstream = s_('Branches|diverged from upstream')
.controls.hidden-xs< .controls.hidden-xs<
- if merge_project && create_mr_button?(@repository.root_ref, branch.name) - 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 = 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 - 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 = link_to project_compare_index_path(@project, from: @repository.root_ref, to: branch.name),
Compare 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] = render 'projects/buttons/download', project: @project, ref: branch.name, pipeline: @refs_pipelines[branch.name]
...@@ -40,12 +43,12 @@ ...@@ -40,12 +43,12 @@
- if branch.name == @project.repository.root_ref - if branch.name == @project.repository.root_ref
%button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip disabled", %button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip disabled",
disabled: true, disabled: true,
title: "The default branch cannot be deleted" } title: s_('Branches|The default branch cannot be deleted') }
= icon("trash-o") = icon("trash-o")
- elsif protected_branch?(@project, branch) - elsif protected_branch?(@project, branch)
- if can?(current_user, :delete_protected_branch, @project) - if can?(current_user, :delete_protected_branch, @project)
%button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip", %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", data: { toggle: "modal",
target: "#modal-delete-branch", target: "#modal-delete-branch",
delete_path: project_branch_path(@project, branch.name), delete_path: project_branch_path(@project, branch.name),
...@@ -55,20 +58,22 @@ ...@@ -55,20 +58,22 @@
- else - else
%button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip disabled", %button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip disabled",
disabled: true, 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") = icon("trash-o")
- else - else
= link_to project_branch_path(@project, branch.name), = link_to project_branch_path(@project, branch.name),
class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip", class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip",
title: "Delete branch", title: s_('Branches|Delete branch'),
method: :delete, 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, remote: true,
"aria-label" => "Delete branch" do 'aria-label' => s_('Branches|Delete branch') do
= icon("trash-o") = icon("trash-o")
- if branch.name != @repository.root_ref - 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 .graph-side
.bar.bar-behind{ style: "width: #{number_commits_behind * bar_graph_width_factor}%" } .bar.bar-behind{ style: "width: #{number_commits_behind * bar_graph_width_factor}%" }
%span.count.count-behind= number_commits_behind %span.count.count-behind= number_commits_behind
...@@ -82,4 +87,4 @@ ...@@ -82,4 +87,4 @@
= render 'projects/branches/commit', commit: commit, project: @project = render 'projects/branches/commit', commit: commit, project: @project
- else - else
%p %p
Cant find HEAD commit for this branch = s_('Branches|Cant find HEAD commit for this branch')
...@@ -4,36 +4,38 @@ ...@@ -4,36 +4,38 @@
.modal-header .modal-header
%button.close{ data: { dismiss: 'modal' } } × %button.close{ data: { dismiss: 'modal' } } ×
%h3.page-title %h3.page-title
Delete protected branch - title_branch_name = capture do
= surround "'", "'?" do
%span.js-branch-name.ref-name>[branch name] %span.js-branch-name.ref-name>[branch name]
= s_("Branches|Delete protected branch '%{branch_name}'?").html_safe % { branch_name: title_branch_name }
.modal-body .modal-body
%p %p
You’re about to permanently delete the protected branch - branch_name = capture do
= succeed '.' do %strong.js-branch-name.ref-name>[branch name]
%strong.js-branch-name.ref-name [branch name] = s_('Branches|You’re about to permanently delete the protected branch %{branch_name}.').html_safe % { branch_name: branch_name }
%p.js-not-merged %p.js-not-merged
- default_branch = capture do - default_branch = capture do
%span.ref-name= @repository.root_ref %span.ref-name= @repository.root_ref
= s_("Branches|This branch hasn’t been merged into %{default_branch}.").html_safe % { default_branch: default_branch } = s_('Branches|This branch hasn’t 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|To avoid data loss, consider merging this branch before deleting it.')
%p %p
Once you confirm and press - delete_protected_branch = capture do
= succeed ',' do %strong
%strong Delete protected branch = s_('Branches|Delete protected branch')
it cannot be undone or recovered. = 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 %p
%strong To confirm, type - branch_name_confirmation = capture do
%kbd.js-branch-name [branch name] %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 .form-group
= text_field_tag 'delete_branch_input', '', class: 'form-control js-delete-branch-input' = text_field_tag 'delete_branch_input', '', class: 'form-control js-delete-branch-input'
.modal-footer .modal-footer
%button.btn{ data: { dismiss: 'modal' } } Cancel %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", class: "btn btn-danger js-delete-branch",
title: 'Delete branch', title: s_('Branches|Delete branch'),
method: :delete, method: :delete,
"aria-label" => "Delete" 'aria-label' => s_('Branches|Delete branch')
- @no_container = true - @no_container = true
- page_title "Branches" - page_title _('Branches')
- add_to_breadcrumbs("Repository", project_tree_path(@project)) - add_to_breadcrumbs(_('Repository'), project_tree_path(@project))
= render "projects/commits/head" = render "projects/commits/head"
%div{ class: container_class } %div{ class: container_class }
.top-area.adjust .top-area.adjust
- if can?(current_user, :admin_project, @project) - if can?(current_user, :admin_project, @project)
.nav-text .nav-text
Protected branches can be managed in - project_settings_link = link_to s_('Branches|project settings'), project_protected_branches_path(@project)
= link_to '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 .nav-controls
= form_tag(filter_branches_path, method: :get) do = 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> .dropdown.inline>
%button.dropdown-menu-toggle{ type: 'button', 'data-toggle' => 'dropdown' } %button.dropdown-menu-toggle{ type: 'button', 'data-toggle' => 'dropdown' }
...@@ -21,16 +21,21 @@ ...@@ -21,16 +21,21 @@
= icon('chevron-down') = icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable
%li.dropdown-header %li.dropdown-header
Sort by = s_('Branches|Sort by')
- branches_sort_options_hash.each do |value, title| - branches_sort_options_hash.each do |value, title|
%li %li
= link_to title, filter_branches_path(sort: value), class: ("is-active" if @sort == value) = link_to title, filter_branches_path(sort: value), class: ("is-active" if @sort == value)
- if can? current_user, :push_code, @project - 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 = link_to project_merged_branches_path(@project),
Delete merged branches 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 = link_to new_project_branch_path(@project), class: 'btn btn-create' do
New branch = s_('Branches|New branch')
= render 'projects/commits/mirror_status' = render 'projects/commits/mirror_status'
- if @branches.any? - if @branches.any?
%ul.content-list.all-branches %ul.content-list.all-branches
...@@ -38,6 +43,7 @@ ...@@ -38,6 +43,7 @@
= render "projects/branches/branch", branch: branch = render "projects/branches/branch", branch: branch
= paginate @branches, theme: 'gitlab' = paginate @branches, theme: 'gitlab'
- else - else
.nothing-here-block No branches to show .nothing-here-block
= s_('Branches|No branches to show')
= render 'projects/branches/delete_protected_modal' = render 'projects/branches/delete_protected_modal'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment