Externalize strings in helpers

- Update qa selector
- Update PO file
This commit is contained in:
Martin Wortschack 2019-04-04 17:05:25 +00:00 committed by Nick Thomas
parent d0b9ab1910
commit 2e75605272
10 changed files with 155 additions and 55 deletions

View file

@ -77,7 +77,7 @@ module BlobHelper
project, project,
ref, ref,
path, path,
label: "Replace", label: _("Replace"),
action: "replace", action: "replace",
btn_class: "default", btn_class: "default",
modal_type: "upload" modal_type: "upload"
@ -89,7 +89,7 @@ module BlobHelper
project, project,
ref, ref,
path, path,
label: "Delete", label: _("Delete"),
action: "delete", action: "delete",
btn_class: "remove", btn_class: "remove",
modal_type: "remove" modal_type: "remove"
@ -101,14 +101,14 @@ module BlobHelper
end end
def leave_edit_message def leave_edit_message
"Leave edit mode?\nAll unsaved changes will be lost." _("Leave edit mode? All unsaved changes will be lost.")
end end
def editing_preview_title(filename) def editing_preview_title(filename)
if Gitlab::MarkupHelper.previewable?(filename) if Gitlab::MarkupHelper.previewable?(filename)
'Preview' _('Preview')
else else
'Preview changes' _('Preview changes')
end end
end end
@ -201,14 +201,14 @@ module BlobHelper
return if blob.empty? return if blob.empty?
return if blob.binary? || blob.stored_externally? return if blob.binary? || blob.stored_externally?
title = 'Open raw' title = _('Open raw')
link_to icon('file-code-o'), blob_raw_path, class: 'btn btn-sm has-tooltip', target: '_blank', rel: 'noopener noreferrer', title: title, data: { container: 'body' } link_to icon('file-code-o'), blob_raw_path, class: 'btn btn-sm has-tooltip', target: '_blank', rel: 'noopener noreferrer', title: title, data: { container: 'body' }
end end
def download_blob_button(blob) def download_blob_button(blob)
return if blob.empty? return if blob.empty?
title = 'Download' title = _('Download')
link_to sprite_icon('download'), blob_raw_path(inline: false), download: @path, class: 'btn btn-sm has-tooltip', target: '_blank', rel: 'noopener noreferrer', title: title, data: { container: 'body' } link_to sprite_icon('download'), blob_raw_path(inline: false), download: @path, class: 'btn btn-sm has-tooltip', target: '_blank', rel: 'noopener noreferrer', title: title, data: { container: 'body' }
end end

View file

@ -4,12 +4,12 @@ module BuildsHelper
def build_summary(build, skip: false) def build_summary(build, skip: false)
if build.has_trace? if build.has_trace?
if skip if skip
link_to "View job trace", pipeline_job_url(build.pipeline, build) link_to _("View job trace"), pipeline_job_url(build.pipeline, build)
else else
build.trace.html(last_lines: 10).html_safe build.trace.html(last_lines: 10).html_safe
end end
else else
"No job trace" _("No job trace")
end end
end end
@ -31,7 +31,7 @@ module BuildsHelper
def build_failed_issue_options def build_failed_issue_options
{ {
title: "Job Failed ##{@build.id}", title: _("Job Failed #%{build_id}") % { build_id: @build.id },
description: project_job_url(@project, @build) description: project_job_url(@project, @build)
} }
end end

View file

@ -21,7 +21,7 @@ module ButtonHelper
# See http://clipboardjs.com/#usage # See http://clipboardjs.com/#usage
def clipboard_button(data = {}) def clipboard_button(data = {})
css_class = data[:class] || 'btn-clipboard btn-transparent' css_class = data[:class] || 'btn-clipboard btn-transparent'
title = data[:title] || 'Copy to clipboard' title = data[:title] || _('Copy to clipboard')
button_text = data[:button_text] || '' button_text = data[:button_text] || ''
hide_tooltip = data[:hide_tooltip] || false hide_tooltip = data[:hide_tooltip] || false
hide_button_icon = data[:hide_button_icon] || false hide_button_icon = data[:hide_button_icon] || false

View file

@ -4,8 +4,7 @@ module FormHelper
def form_errors(model, type: 'form') def form_errors(model, type: 'form')
return unless model.errors.any? return unless model.errors.any?
pluralized = 'error'.pluralize(model.errors.count) headline = n_('The %{type} contains the following error:', 'The %{type} contains the following errors:', model.errors.count) % { type: type }
headline = "The #{type} contains the following #{pluralized}:"
content_tag(:div, class: 'alert alert-danger', id: 'error_explanation') do content_tag(:div, class: 'alert alert-danger', id: 'error_explanation') do
content_tag(:h4, headline) << content_tag(:h4, headline) <<
@ -24,7 +23,7 @@ module FormHelper
title: 'Select assignee', title: 'Select assignee',
filter: true, filter: true,
dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee', dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee',
placeholder: 'Search users', placeholder: _('Search users'),
data: { data: {
first_user: current_user&.username, first_user: current_user&.username,
null_user: true, null_user: true,

View file

@ -181,8 +181,8 @@ module LabelsHelper
def label_deletion_confirm_text(label) def label_deletion_confirm_text(label)
case label case label
when GroupLabel then 'Remove this label? This will affect all projects within the group. Are you sure?' when GroupLabel then _('Remove this label? This will affect all projects within the group. Are you sure?')
when ProjectLabel then 'Remove this label? Are you sure?' when ProjectLabel then _('Remove this label? Are you sure?')
end end
end end

View file

@ -30,7 +30,7 @@ module SearchHelper
to = collection.offset_value + collection.to_a.size to = collection.offset_value + collection.to_a.size
count = collection.total_count count = collection.total_count
"Showing #{from} - #{to} of #{count} #{scope.humanize(capitalize: false)} for \"#{term}\"" s_("SearchResults|Showing %{from} - %{to} of %{count} %{scope} for \"%{term}\"") % { from: from, to: to, count: count, scope: scope.humanize(capitalize: false), term: term }
end end
def find_project_for_result_blob(projects, result) def find_project_for_result_blob(projects, result)
@ -59,31 +59,31 @@ module SearchHelper
# Autocomplete results for various settings pages # Autocomplete results for various settings pages
def default_autocomplete def default_autocomplete
[ [
{ category: "Settings", label: "User settings", url: profile_path }, { category: "Settings", label: _("User settings"), url: profile_path },
{ category: "Settings", label: "SSH Keys", url: profile_keys_path }, { category: "Settings", label: _("SSH Keys"), url: profile_keys_path },
{ category: "Settings", label: "Dashboard", url: root_path } { category: "Settings", label: _("Dashboard"), url: root_path }
] ]
end end
# Autocomplete results for settings pages, for admins # Autocomplete results for settings pages, for admins
def default_autocomplete_admin def default_autocomplete_admin
[ [
{ category: "Settings", label: "Admin Section", url: admin_root_path } { category: "Settings", label: _("Admin Section"), url: admin_root_path }
] ]
end end
# Autocomplete results for internal help pages # Autocomplete results for internal help pages
def help_autocomplete def help_autocomplete
[ [
{ category: "Help", label: "API Help", url: help_page_path("api/README") }, { category: "Help", label: _("API Help"), url: help_page_path("api/README") },
{ category: "Help", label: "Markdown Help", url: help_page_path("user/markdown") }, { category: "Help", label: _("Markdown Help"), url: help_page_path("user/markdown") },
{ category: "Help", label: "Permissions Help", url: help_page_path("user/permissions") }, { category: "Help", label: _("Permissions Help"), url: help_page_path("user/permissions") },
{ category: "Help", label: "Public Access Help", url: help_page_path("public_access/public_access") }, { category: "Help", label: _("Public Access Help"), url: help_page_path("public_access/public_access") },
{ category: "Help", label: "Rake Tasks Help", url: help_page_path("raketasks/README") }, { category: "Help", label: _("Rake Tasks Help"), url: help_page_path("raketasks/README") },
{ category: "Help", label: "SSH Keys Help", url: help_page_path("ssh/README") }, { category: "Help", label: _("SSH Keys Help"), url: help_page_path("ssh/README") },
{ category: "Help", label: "System Hooks Help", url: help_page_path("system_hooks/system_hooks") }, { category: "Help", label: _("System Hooks Help"), url: help_page_path("system_hooks/system_hooks") },
{ category: "Help", label: "Webhooks Help", url: help_page_path("user/project/integrations/webhooks") }, { category: "Help", label: _("Webhooks Help"), url: help_page_path("user/project/integrations/webhooks") },
{ category: "Help", label: "Workflow Help", url: help_page_path("workflow/README") } { category: "Help", label: _("Workflow Help"), url: help_page_path("workflow/README") }
] ]
end end
@ -93,16 +93,16 @@ module SearchHelper
ref = @ref || @project.repository.root_ref ref = @ref || @project.repository.root_ref
[ [
{ category: "In this project", label: "Files", url: project_tree_path(@project, ref) }, { category: "In this project", label: _("Files"), url: project_tree_path(@project, ref) },
{ category: "In this project", label: "Commits", url: project_commits_path(@project, ref) }, { category: "In this project", label: _("Commits"), url: project_commits_path(@project, ref) },
{ category: "In this project", label: "Network", url: project_network_path(@project, ref) }, { category: "In this project", label: _("Network"), url: project_network_path(@project, ref) },
{ category: "In this project", label: "Graph", url: project_graph_path(@project, ref) }, { category: "In this project", label: _("Graph"), url: project_graph_path(@project, ref) },
{ category: "In this project", label: "Issues", url: project_issues_path(@project) }, { category: "In this project", label: _("Issues"), url: project_issues_path(@project) },
{ category: "In this project", label: "Merge Requests", url: project_merge_requests_path(@project) }, { category: "In this project", label: _("Merge Requests"), url: project_merge_requests_path(@project) },
{ category: "In this project", label: "Milestones", url: project_milestones_path(@project) }, { category: "In this project", label: _("Milestones"), url: project_milestones_path(@project) },
{ category: "In this project", label: "Snippets", url: project_snippets_path(@project) }, { category: "In this project", label: _("Snippets"), url: project_snippets_path(@project) },
{ category: "In this project", label: "Members", url: project_project_members_path(@project) }, { category: "In this project", label: _("Members"), url: project_project_members_path(@project) },
{ category: "In this project", label: "Wiki", url: project_wikis_path(@project) } { category: "In this project", label: _("Wiki"), url: project_wikis_path(@project) }
] ]
else else
[] []
@ -162,7 +162,7 @@ module SearchHelper
opts = opts =
{ {
id: "filtered-search-#{type}", id: "filtered-search-#{type}",
placeholder: 'Search or filter results...', placeholder: _('Search or filter results...'),
data: { data: {
'username-params' => UserSerializer.new.represent(@users) 'username-params' => UserSerializer.new.represent(@users)
}, },

View file

@ -86,17 +86,17 @@ module TreeHelper
end end
def edit_in_new_fork_notice_now def edit_in_new_fork_notice_now
"You're not allowed to make changes to this project directly." + _("You're not allowed to make changes to this project directly. "\
" A fork of this project is being created that you can make changes in, so you can submit a merge request." "A fork of this project is being created that you can make changes in, so you can submit a merge request.")
end end
def edit_in_new_fork_notice def edit_in_new_fork_notice
"You're not allowed to make changes to this project directly." + _("You're not allowed to make changes to this project directly. "\
" A fork of this project has been created that you can make changes in, so you can submit a merge request." "A fork of this project has been created that you can make changes in, so you can submit a merge request.")
end end
def edit_in_new_fork_notice_action(action) def edit_in_new_fork_notice_action(action)
edit_in_new_fork_notice + " Try to #{action} this file again." edit_in_new_fork_notice + _(" Try to %{action} this file again.") % { action: action }
end end
def commit_in_fork_help def commit_in_fork_help

View file

@ -42,11 +42,11 @@ module VisibilityLevelHelper
def group_visibility_level_description(level) def group_visibility_level_description(level)
case level case level
when Gitlab::VisibilityLevel::PRIVATE when Gitlab::VisibilityLevel::PRIVATE
"The group and its projects can only be viewed by members." _("The group and its projects can only be viewed by members.")
when Gitlab::VisibilityLevel::INTERNAL when Gitlab::VisibilityLevel::INTERNAL
"The group and any internal projects can be viewed by any logged in user." _("The group and any internal projects can be viewed by any logged in user.")
when Gitlab::VisibilityLevel::PUBLIC when Gitlab::VisibilityLevel::PUBLIC
"The group and any public projects can be viewed without any authentication." _("The group and any public projects can be viewed without any authentication.")
end end
end end
@ -54,20 +54,20 @@ module VisibilityLevelHelper
case level case level
when Gitlab::VisibilityLevel::PRIVATE when Gitlab::VisibilityLevel::PRIVATE
if snippet.is_a? ProjectSnippet if snippet.is_a? ProjectSnippet
"The snippet is visible only to project members." _("The snippet is visible only to project members.")
else else
"The snippet is visible only to me." _("The snippet is visible only to me.")
end end
when Gitlab::VisibilityLevel::INTERNAL when Gitlab::VisibilityLevel::INTERNAL
"The snippet is visible to any logged in user." _("The snippet is visible to any logged in user.")
when Gitlab::VisibilityLevel::PUBLIC when Gitlab::VisibilityLevel::PUBLIC
"The snippet can be accessed without any authentication." _("The snippet can be accessed without any authentication.")
end end
end end
def restricted_visibility_level_description(level) def restricted_visibility_level_description(level)
level_name = Gitlab::VisibilityLevel.level_name(level) level_name = Gitlab::VisibilityLevel.level_name(level)
"#{level_name.capitalize} visibility has been restricted by the administrator." _("%{level_name} visibility has been restricted by the administrator.") % { level_name: level_name.capitalize }
end end
def disallowed_visibility_level_description(level, form_model) def disallowed_visibility_level_description(level, form_model)

View file

@ -19,6 +19,9 @@ msgstr ""
msgid " Status" msgid " Status"
msgstr "" msgstr ""
msgid " Try to %{action} this file again."
msgstr ""
msgid " You need to do this before %{grace_period_deadline}." msgid " You need to do this before %{grace_period_deadline}."
msgstr "" msgstr ""
@ -126,6 +129,9 @@ msgstr ""
msgid "%{label_for_message} unavailable" msgid "%{label_for_message} unavailable"
msgstr "" msgstr ""
msgid "%{level_name} visibility has been restricted by the administrator."
msgstr ""
msgid "%{link_start}Read more%{link_end} about role permissions" msgid "%{link_start}Read more%{link_end} about role permissions"
msgstr "" msgstr ""
@ -351,6 +357,9 @@ msgstr ""
msgid "A user with write access to the source branch selected this option" msgid "A user with write access to the source branch selected this option"
msgstr "" msgstr ""
msgid "API Help"
msgstr ""
msgid "About GitLab" msgid "About GitLab"
msgstr "" msgstr ""
@ -480,6 +489,9 @@ msgstr ""
msgid "Admin Overview" msgid "Admin Overview"
msgstr "" msgstr ""
msgid "Admin Section"
msgstr ""
msgid "AdminArea| You are about to permanently delete the user %{username}. Issues, merge requests, and groups linked to them will be transferred to a system-wide \"Ghost-user\". To avoid data loss, consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, it cannot be undone or recovered." msgid "AdminArea| You are about to permanently delete the user %{username}. Issues, merge requests, and groups linked to them will be transferred to a system-wide \"Ghost-user\". To avoid data loss, consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, it cannot be undone or recovered."
msgstr "" msgstr ""
@ -4529,6 +4541,9 @@ msgstr ""
msgid "Job" msgid "Job"
msgstr "" msgstr ""
msgid "Job Failed #%{build_id}"
msgstr ""
msgid "Job ID" msgid "Job ID"
msgstr "" msgstr ""
@ -4774,6 +4789,9 @@ msgstr ""
msgid "Leave" msgid "Leave"
msgstr "" msgstr ""
msgid "Leave edit mode? All unsaved changes will be lost."
msgstr ""
msgid "Leave group" msgid "Leave group"
msgstr "" msgstr ""
@ -4923,6 +4941,9 @@ msgstr ""
msgid "Markdown" msgid "Markdown"
msgstr "" msgstr ""
msgid "Markdown Help"
msgstr ""
msgid "Markdown enabled" msgid "Markdown enabled"
msgstr "" msgstr ""
@ -5393,6 +5414,9 @@ msgstr ""
msgid "No files found." msgid "No files found."
msgstr "" msgstr ""
msgid "No job trace"
msgstr ""
msgid "No labels with such name or description" msgid "No labels with such name or description"
msgstr "" msgstr ""
@ -5617,6 +5641,9 @@ msgstr ""
msgid "Open in Xcode" msgid "Open in Xcode"
msgstr "" msgstr ""
msgid "Open raw"
msgstr ""
msgid "Open sidebar" msgid "Open sidebar"
msgstr "" msgstr ""
@ -5740,6 +5767,9 @@ msgstr ""
msgid "Permissions" msgid "Permissions"
msgstr "" msgstr ""
msgid "Permissions Help"
msgstr ""
msgid "Permissions, LFS, 2FA" msgid "Permissions, LFS, 2FA"
msgstr "" msgstr ""
@ -6016,6 +6046,9 @@ msgstr ""
msgid "Preview" msgid "Preview"
msgstr "" msgstr ""
msgid "Preview changes"
msgstr ""
msgid "Preview payload" msgid "Preview payload"
msgstr "" msgstr ""
@ -6547,6 +6580,9 @@ msgstr ""
msgid "Public - The project can be accessed without any authentication." msgid "Public - The project can be accessed without any authentication."
msgstr "" msgstr ""
msgid "Public Access Help"
msgstr ""
msgid "Public deploy keys (%{deploy_keys_count})" msgid "Public deploy keys (%{deploy_keys_count})"
msgstr "" msgstr ""
@ -6577,6 +6613,9 @@ msgstr ""
msgid "README" msgid "README"
msgstr "" msgstr ""
msgid "Rake Tasks Help"
msgstr ""
msgid "Read more" msgid "Read more"
msgstr "" msgstr ""
@ -6672,6 +6711,12 @@ msgstr ""
msgid "Remove project" msgid "Remove project"
msgstr "" msgstr ""
msgid "Remove this label? Are you sure?"
msgstr ""
msgid "Remove this label? This will affect all projects within the group. Are you sure?"
msgstr ""
msgid "Removed group can not be restored!" msgid "Removed group can not be restored!"
msgstr "" msgstr ""
@ -6690,6 +6735,9 @@ msgstr ""
msgid "Reopen milestone" msgid "Reopen milestone"
msgstr "" msgstr ""
msgid "Replace"
msgstr ""
msgid "Reply to comment" msgid "Reply to comment"
msgstr "" msgstr ""
@ -6914,6 +6962,9 @@ msgstr ""
msgid "SSH Keys" msgid "SSH Keys"
msgstr "" msgstr ""
msgid "SSH Keys Help"
msgstr ""
msgid "SSH host keys" msgid "SSH host keys"
msgstr "" msgstr ""
@ -7040,6 +7091,9 @@ msgstr ""
msgid "SearchAutocomplete|in this project" msgid "SearchAutocomplete|in this project"
msgstr "" msgstr ""
msgid "SearchResults|Showing %{from} - %{to} of %{count} %{scope} for \"%{term}\""
msgstr ""
msgid "Secret" msgid "Secret"
msgstr "" msgstr ""
@ -7738,6 +7792,9 @@ msgstr ""
msgid "System Hooks" msgid "System Hooks"
msgstr "" msgstr ""
msgid "System Hooks Help"
msgstr ""
msgid "System Info" msgid "System Info"
msgstr "" msgstr ""
@ -7870,6 +7927,11 @@ msgstr ""
msgid "Test failed." msgid "Test failed."
msgstr "" msgstr ""
msgid "The %{type} contains the following error:"
msgid_plural "The %{type} contains the following errors:"
msgstr[0] ""
msgstr[1] ""
msgid "The Git LFS objects will <strong>not</strong> be synced." msgid "The Git LFS objects will <strong>not</strong> be synced."
msgstr "" msgstr ""
@ -7912,6 +7974,15 @@ msgstr ""
msgid "The global settings require you to enable Two-Factor Authentication for your account." msgid "The global settings require you to enable Two-Factor Authentication for your account."
msgstr "" msgstr ""
msgid "The group and any internal projects can be viewed by any logged in user."
msgstr ""
msgid "The group and any public projects can be viewed without any authentication."
msgstr ""
msgid "The group and its projects can only be viewed by members."
msgstr ""
msgid "The group settings for %{group_links} require you to enable Two-Factor Authentication for your account. You can %{leave_group_links}." msgid "The group settings for %{group_links} require you to enable Two-Factor Authentication for your account. You can %{leave_group_links}."
msgstr "" msgstr ""
@ -7990,6 +8061,18 @@ msgstr ""
msgid "The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request." msgid "The review stage shows the time from creating the merge request to merging it. The data will automatically be added after you merge your first merge request."
msgstr "" msgstr ""
msgid "The snippet can be accessed without any authentication."
msgstr ""
msgid "The snippet is visible only to me."
msgstr ""
msgid "The snippet is visible only to project members."
msgstr ""
msgid "The snippet is visible to any logged in user."
msgstr ""
msgid "The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time." msgid "The staging stage shows the time between merging the MR and deploying code to the production environment. The data will be automatically added once you deploy to production for the first time."
msgstr "" msgstr ""
@ -8840,6 +8923,9 @@ msgstr ""
msgid "User map" msgid "User map"
msgstr "" msgstr ""
msgid "User settings"
msgstr ""
msgid "User was successfully created." msgid "User was successfully created."
msgstr "" msgstr ""
@ -8993,6 +9079,9 @@ msgstr ""
msgid "View it on GitLab" msgid "View it on GitLab"
msgstr "" msgstr ""
msgid "View job trace"
msgstr ""
msgid "View jobs" msgid "View jobs"
msgstr "" msgstr ""
@ -9068,6 +9157,9 @@ msgstr ""
msgid "Web terminal" msgid "Web terminal"
msgstr "" msgstr ""
msgid "Webhooks Help"
msgstr ""
msgid "When a runner is locked, it cannot be assigned to other projects" msgid "When a runner is locked, it cannot be assigned to other projects"
msgstr "" msgstr ""
@ -9233,6 +9325,9 @@ msgstr ""
msgid "Withdraw Access Request" msgid "Withdraw Access Request"
msgstr "" msgstr ""
msgid "Workflow Help"
msgstr ""
msgid "Write" msgid "Write"
msgstr "" msgstr ""
@ -9437,6 +9532,12 @@ msgstr ""
msgid "You'll need to use different branch names to get a valid comparison." msgid "You'll need to use different branch names to get a valid comparison."
msgstr "" msgstr ""
msgid "You're not allowed to make changes to this project directly. A fork of this project has been created that you can make changes in, so you can submit a merge request."
msgstr ""
msgid "You're not allowed to make changes to this project directly. A fork of this project is being created that you can make changes in, so you can submit a merge request."
msgstr ""
msgid "You're only seeing %{startTag}other activity%{endTag} in the feed. To add a comment, switch to one of the following options." msgid "You're only seeing %{startTag}other activity%{endTag} in the feed. To add a comment, switch to one of the following options."
msgstr "" msgstr ""

View file

@ -6,7 +6,7 @@ module QA
view 'app/helpers/blob_helper.rb' do view 'app/helpers/blob_helper.rb' do
element :edit_button, "_('Edit')" # rubocop:disable QA/ElementWithPattern element :edit_button, "_('Edit')" # rubocop:disable QA/ElementWithPattern
element :delete_button, /label:\s+"Delete"/ # rubocop:disable QA/ElementWithPattern element :delete_button, '_("Delete")' # rubocop:disable QA/ElementWithPattern
end end
view 'app/views/projects/blob/_remove.html.haml' do view 'app/views/projects/blob/_remove.html.haml' do