Commit 00994bea authored by Nick Thomas's avatar Nick Thomas

Merge branch 'ee-mw-i18n-helpers' into 'master'

(EE port) Externalize strings in helpers

See merge request gitlab-org/gitlab-ee!10554
parents 4fc0c8b1 a86d49a6
......@@ -77,7 +77,7 @@ module BlobHelper
project,
ref,
path,
label: "Replace",
label: _("Replace"),
action: "replace",
btn_class: "default",
modal_type: "upload"
......@@ -89,7 +89,7 @@ module BlobHelper
project,
ref,
path,
label: "Delete",
label: _("Delete"),
action: "delete",
btn_class: "remove",
modal_type: "remove"
......@@ -101,14 +101,14 @@ module BlobHelper
end
def leave_edit_message
"Leave edit mode?\nAll unsaved changes will be lost."
_("Leave edit mode? All unsaved changes will be lost.")
end
def editing_preview_title(filename)
if Gitlab::MarkupHelper.previewable?(filename)
'Preview'
_('Preview')
else
'Preview changes'
_('Preview changes')
end
end
......@@ -201,14 +201,14 @@ module BlobHelper
return if blob.empty?
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' }
end
def download_blob_button(blob)
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' }
end
......
......@@ -4,12 +4,12 @@ module BuildsHelper
def build_summary(build, skip: false)
if build.has_trace?
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
build.trace.html(last_lines: 10).html_safe
end
else
"No job trace"
_("No job trace")
end
end
......@@ -31,7 +31,7 @@ module BuildsHelper
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)
}
end
......
......@@ -21,7 +21,7 @@ module ButtonHelper
# See http://clipboardjs.com/#usage
def clipboard_button(data = {})
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] || ''
hide_tooltip = data[:hide_tooltip] || false
hide_button_icon = data[:hide_button_icon] || false
......
......@@ -6,8 +6,7 @@ module FormHelper
def form_errors(model, type: 'form')
return unless model.errors.any?
pluralized = 'error'.pluralize(model.errors.count)
headline = "The #{type} contains the following #{pluralized}:"
headline = n_('The %{type} contains the following error:', 'The %{type} contains the following errors:', model.errors.count) % { type: type }
content_tag(:div, class: 'alert alert-danger', id: 'error_explanation') do
content_tag(:h4, headline) <<
......@@ -26,7 +25,7 @@ module FormHelper
title: 'Select assignee',
filter: true,
dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee',
placeholder: 'Search users',
placeholder: _('Search users'),
data: {
first_user: current_user&.username,
null_user: true,
......
......@@ -181,8 +181,8 @@ module LabelsHelper
def label_deletion_confirm_text(label)
case label
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 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?')
end
end
......
......@@ -30,7 +30,7 @@ module SearchHelper
to = collection.offset_value + collection.to_a.size
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
def find_project_for_result_blob(projects, result)
......@@ -59,31 +59,31 @@ module SearchHelper
# Autocomplete results for various settings pages
def default_autocomplete
[
{ category: "Settings", label: "User settings", url: profile_path },
{ category: "Settings", label: "SSH Keys", url: profile_keys_path },
{ category: "Settings", label: "Dashboard", url: root_path }
{ category: "Settings", label: _("User settings"), url: profile_path },
{ category: "Settings", label: _("SSH Keys"), url: profile_keys_path },
{ category: "Settings", label: _("Dashboard"), url: root_path }
]
end
# Autocomplete results for settings pages, for admins
def default_autocomplete_admin
[
{ category: "Settings", label: "Admin Section", url: admin_root_path }
{ category: "Settings", label: _("Admin Section"), url: admin_root_path }
]
end
# Autocomplete results for internal help pages
def help_autocomplete
[
{ 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: "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: "Rake Tasks Help", url: help_page_path("raketasks/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: "Webhooks Help", url: help_page_path("user/project/integrations/webhooks") },
{ category: "Help", label: "Workflow Help", url: help_page_path("workflow/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: _("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: _("Rake Tasks Help"), url: help_page_path("raketasks/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: _("Webhooks Help"), url: help_page_path("user/project/integrations/webhooks") },
{ category: "Help", label: _("Workflow Help"), url: help_page_path("workflow/README") }
]
end
......@@ -93,16 +93,16 @@ module SearchHelper
ref = @ref || @project.repository.root_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: "Network", url: project_network_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: "Merge Requests", url: project_merge_requests_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: "Members", url: project_project_members_path(@project) },
{ category: "In this project", label: "Wiki", url: project_wikis_path(@project) }
{ 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: _("Network"), url: project_network_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: _("Merge Requests"), url: project_merge_requests_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: _("Members"), url: project_project_members_path(@project) },
{ category: "In this project", label: _("Wiki"), url: project_wikis_path(@project) }
]
else
[]
......@@ -162,7 +162,7 @@ module SearchHelper
opts =
{
id: "filtered-search-#{type}",
placeholder: 'Search or filter results...',
placeholder: _('Search or filter results...'),
data: {
'username-params' => UserSerializer.new.represent(@users)
},
......
......@@ -86,17 +86,17 @@ module TreeHelper
end
def edit_in_new_fork_notice_now
"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."
_("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.")
end
def edit_in_new_fork_notice
"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."
_("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.")
end
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
def commit_in_fork_help
......
......@@ -42,11 +42,11 @@ module VisibilityLevelHelper
def group_visibility_level_description(level)
case level
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
"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
"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
......@@ -54,20 +54,20 @@ module VisibilityLevelHelper
case level
when Gitlab::VisibilityLevel::PRIVATE
if snippet.is_a? ProjectSnippet
"The snippet is visible only to project members."
_("The snippet is visible only to project members.")
else
"The snippet is visible only to me."
_("The snippet is visible only to me.")
end
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
"The snippet can be accessed without any authentication."
_("The snippet can be accessed without any authentication.")
end
end
def restricted_visibility_level_description(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
def disallowed_visibility_level_description(level, form_model)
......
......@@ -19,6 +19,9 @@ msgstr ""
msgid " Status"
msgstr ""
msgid " Try to %{action} this file again."
msgstr ""
msgid " You need to do this before %{grace_period_deadline}."
msgstr ""
......@@ -183,6 +186,9 @@ msgstr ""
msgid "%{label_for_message} unavailable"
msgstr ""
msgid "%{level_name} visibility has been restricted by the administrator."
msgstr ""
msgid "%{link_start}Read more%{link_end} about role permissions"
msgstr ""
......@@ -446,6 +452,9 @@ msgstr ""
msgid "A user with write access to the source branch selected this option"
msgstr ""
msgid "API Help"
msgstr ""
msgid "About GitLab"
msgstr ""
......@@ -626,6 +635,9 @@ msgstr ""
msgid "Admin Overview"
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."
msgstr ""
......@@ -5983,6 +5995,9 @@ msgstr ""
msgid "Job"
msgstr ""
msgid "Job Failed #%{build_id}"
msgstr ""
msgid "Job ID"
msgstr ""
......@@ -6252,6 +6267,9 @@ msgstr ""
msgid "Leave"
msgstr ""
msgid "Leave edit mode? All unsaved changes will be lost."
msgstr ""
msgid "Leave group"
msgstr ""
......@@ -6509,6 +6527,9 @@ msgstr ""
msgid "Markdown"
msgstr ""
msgid "Markdown Help"
msgstr ""
msgid "Markdown enabled"
msgstr ""
......@@ -7129,6 +7150,9 @@ msgstr ""
msgid "No issues for the selected time period."
msgstr ""
msgid "No job trace"
msgstr ""
msgid "No labels with such name or description"
msgstr ""
......@@ -7392,6 +7416,9 @@ msgstr ""
msgid "Open projects"
msgstr ""
msgid "Open raw"
msgstr ""
msgid "Open sidebar"
msgstr ""
......@@ -7551,6 +7578,9 @@ msgstr ""
msgid "Permissions"
msgstr ""
msgid "Permissions Help"
msgstr ""
msgid "Permissions, LFS, 2FA"
msgstr ""
......@@ -7872,6 +7902,9 @@ msgstr ""
msgid "Preview"
msgstr ""
msgid "Preview changes"
msgstr ""
msgid "Preview payload"
msgstr ""
......@@ -8556,6 +8589,9 @@ msgstr ""
msgid "Public - The project can be accessed without any authentication."
msgstr ""
msgid "Public Access Help"
msgstr ""
msgid "Public deploy keys (%{deploy_keys_count})"
msgstr ""
......@@ -8607,6 +8643,9 @@ msgstr ""
msgid "README"
msgstr ""
msgid "Rake Tasks Help"
msgstr ""
msgid "Read more"
msgstr ""
......@@ -8726,6 +8765,12 @@ msgstr ""
msgid "Remove project"
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!"
msgstr ""
......@@ -8750,6 +8795,9 @@ msgstr ""
msgid "Repair authentication"
msgstr ""
msgid "Replace"
msgstr ""
msgid "Reply to comment"
msgstr ""
......@@ -9071,6 +9119,9 @@ msgstr ""
msgid "SSH Keys"
msgstr ""
msgid "SSH Keys Help"
msgstr ""
msgid "SSH host keys"
msgstr ""
......@@ -9212,6 +9263,9 @@ msgstr ""
msgid "SearchAutocomplete|in this project"
msgstr ""
msgid "SearchResults|Showing %{from} - %{to} of %{count} %{scope} for \"%{term}\""
msgstr ""
msgid "Secret"
msgstr ""
......@@ -10207,6 +10261,9 @@ msgstr ""
msgid "System Hooks"
msgstr ""
msgid "System Hooks Help"
msgstr ""
msgid "System Info"
msgstr ""
......@@ -10351,6 +10408,11 @@ msgstr ""
msgid "The \"%{group_path}\" group allows you to sign in with your Single Sign-On Account"
msgstr ""
msgid "The %{type} contains the following error:"
msgid_plural "The %{type} contains the following errors:"
msgstr[0] ""
msgstr[1] ""
msgid "The Advanced Global Search in GitLab is a powerful search service that saves you time. Instead of creating duplicate code and wasting time, you can now search for code within other teams that can help your own project."
msgstr ""
......@@ -10408,6 +10470,15 @@ msgstr ""
msgid "The global settings require you to enable Two-Factor Authentication for your account."
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}."
msgstr ""
......@@ -10498,6 +10569,18 @@ msgstr ""
msgid "The roadmap shows the progress of your epics along a timeline"
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."
msgstr ""
......@@ -11513,6 +11596,9 @@ msgstr ""
msgid "User map"
msgstr ""
msgid "User settings"
msgstr ""
msgid "User was successfully created."
msgstr ""
......@@ -11678,6 +11764,9 @@ msgstr ""
msgid "View it on GitLab"
msgstr ""
msgid "View job trace"
msgstr ""
msgid "View jobs"
msgstr ""
......@@ -11810,6 +11899,9 @@ msgstr ""
msgid "Web terminal"
msgstr ""
msgid "Webhooks Help"
msgstr ""
msgid "Webhooks allow you to trigger a URL if, for example, new code is pushed or a new issue is created. You can configure webhooks to listen for specific events like pushes, issues or merge requests. Group webhooks will apply to all projects in a group, allowing you to standardize webhook functionality across your entire group."
msgstr ""
......@@ -11993,6 +12085,9 @@ msgstr ""
msgid "Withdraw Access Request"
msgstr ""
msgid "Workflow Help"
msgstr ""
msgid "Write"
msgstr ""
......@@ -12215,6 +12310,12 @@ msgstr ""
msgid "You'll need to use different branch names to get a valid comparison."
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."
msgstr ""
......
......@@ -8,7 +8,7 @@ module QA
view 'app/helpers/blob_helper.rb' do
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
view 'app/views/projects/blob/_remove.html.haml' do
......
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