Commit bce954ea authored by Coung Ngo's avatar Coung Ngo

Improve visibility radio option text on new project page

Make the text translatable

Changelog: fixed
parent ff53a49b
import $ from 'jquery';
import { escape } from 'lodash';
import { __, sprintf } from '~/locale';
import eventHub from '~/projects/new/event_hub';
// Values are from lib/gitlab/visibility_level.rb
......@@ -25,10 +27,21 @@ function setVisibilityOptions({ name, visibility, showPath, editPath }) {
if (reason) {
const optionTitle = option.querySelector('.option-title');
const optionName = optionTitle ? optionTitle.innerText.toLowerCase() : '';
reason.innerHTML = `This project cannot be ${optionName} because the visibility of
<a href="${showPath}">${name}</a> is ${visibility}. To make this project
${optionName}, you must first <a href="${editPath}">change the visibility</a>
of the parent group.`;
reason.innerHTML = sprintf(
__(
'This project cannot be %{visibilityLevel} because the visibility of %{openShowLink}%{name}%{closeShowLink} is %{visibility}. To make this project %{visibilityLevel}, you must first %{openEditLink}change the visibility%{closeEditLink} of the parent group.',
),
{
visibilityLevel: optionName,
name: escape(name),
visibility,
openShowLink: `<a href="${showPath}">`,
closeShowLink: '</a>',
openEditLink: `<a href="${editPath}">`,
closeEditLink: '</a>',
},
false,
);
}
} else {
option.classList.remove('disabled');
......
......@@ -36533,6 +36533,9 @@ msgstr ""
msgid "This project"
msgstr ""
msgid "This project cannot be %{visibilityLevel} because the visibility of %{openShowLink}%{name}%{closeShowLink} is %{visibility}. To make this project %{visibilityLevel}, you must first %{openEditLink}change the visibility%{closeEditLink} of the parent group."
msgstr ""
msgid "This project does not belong to a group and cannot make use of group runners."
msgstr ""
......
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