Commit 3d0b6823 authored by Brandon Labuschagne's avatar Brandon Labuschagne

I18N JS files starting with n

This is one of many MRs opened in order to improve the overall
internationalisation of the GitLab codebase.

This commit only targets Vanilla JS files.

i18n documentation
https://docs.gitlab.com/ee/development/i18n/externalization.html
parent e5d2e7e6
...@@ -4,6 +4,7 @@ import $ from 'jquery'; ...@@ -4,6 +4,7 @@ import $ from 'jquery';
import Api from './api'; import Api from './api';
import { mergeUrlParams } from './lib/utils/url_utility'; import { mergeUrlParams } from './lib/utils/url_utility';
import { parseBoolean } from '~/lib/utils/common_utils'; import { parseBoolean } from '~/lib/utils/common_utils';
import { __ } from './locale';
export default class NamespaceSelect { export default class NamespaceSelect {
constructor(opts) { constructor(opts) {
...@@ -29,7 +30,7 @@ export default class NamespaceSelect { ...@@ -29,7 +30,7 @@ export default class NamespaceSelect {
return Api.namespaces(term, function(namespaces) { return Api.namespaces(term, function(namespaces) {
if (isFilter) { if (isFilter) {
const anyNamespace = { const anyNamespace = {
text: 'Any namespace', text: __('Any namespace'),
id: null, id: null,
}; };
namespaces.unshift(anyNamespace); namespaces.unshift(anyNamespace);
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
import $ from 'jquery'; import $ from 'jquery';
import RefSelectDropdown from './ref_select_dropdown'; import RefSelectDropdown from './ref_select_dropdown';
import { s__ } from './locale';
export default class NewBranchForm { export default class NewBranchForm {
constructor(form, availableRefs) { constructor(form, availableRefs) {
...@@ -29,23 +30,23 @@ export default class NewBranchForm { ...@@ -29,23 +30,23 @@ export default class NewBranchForm {
var endsWith, invalid, single, startsWith; var endsWith, invalid, single, startsWith;
startsWith = { startsWith = {
pattern: /^(\/|\.)/g, pattern: /^(\/|\.)/g,
prefix: "can't start with", prefix: s__("BranchValidation|can't start with"),
conjunction: 'or', conjunction: s__('BranchValidation|or'),
}; };
endsWith = { endsWith = {
pattern: /(\/|\.|\.lock)$/g, pattern: /(\/|\.|\.lock)$/g,
prefix: "can't end in", prefix: s__("BranchValidation|can't end in"),
conjunction: 'or', conjunction: s__('BranchValidation|or'),
}; };
invalid = { invalid = {
pattern: /(\s|~|\^|:|\?|\*|\[|\\|\.\.|@\{|\/{2,}){1}/g, pattern: /(\s|~|\^|:|\?|\*|\[|\\|\.\.|@\{|\/{2,}){1}/g,
prefix: "can't contain", prefix: s__("BranchValidation|can't contain"),
conjunction: ', ', conjunction: ', ',
}; };
single = { single = {
pattern: /^@+$/g, pattern: /^@+$/g,
prefix: "can't be", prefix: s__("BranchValidation|can't be"),
conjunction: 'or', conjunction: s__('BranchValidation|or'),
}; };
return (this.restrictions = [startsWith, invalid, endsWith, single]); return (this.restrictions = [startsWith, invalid, endsWith, single]);
} }
...@@ -66,9 +67,9 @@ export default class NewBranchForm { ...@@ -66,9 +67,9 @@ export default class NewBranchForm {
formatted = values.map(function(value) { formatted = values.map(function(value) {
switch (false) { switch (false) {
case !/\s/.test(value): case !/\s/.test(value):
return 'spaces'; return s__('BranchValidation|spaces');
case !/\/{2,}/g.test(value): case !/\/{2,}/g.test(value):
return 'consecutive slashes'; return s__('BranchValidation|consecutive slashes');
default: default:
return "'" + value + "'"; return "'" + value + "'";
} }
......
...@@ -35,6 +35,7 @@ import { ...@@ -35,6 +35,7 @@ import {
} from './lib/utils/common_utils'; } from './lib/utils/common_utils';
import imageDiffHelper from './image_diff/helpers/index'; import imageDiffHelper from './image_diff/helpers/index';
import { localTimeAgo } from './lib/utils/datetime_utility'; import { localTimeAgo } from './lib/utils/datetime_utility';
import { s__, __ } from './locale';
window.autosize = Autosize; window.autosize = Autosize;
...@@ -253,7 +254,7 @@ export default class Notes { ...@@ -253,7 +254,7 @@ export default class Notes {
discussionNoteForm = $textarea.closest('.js-discussion-note-form'); discussionNoteForm = $textarea.closest('.js-discussion-note-form');
if (discussionNoteForm.length) { if (discussionNoteForm.length) {
if ($textarea.val() !== '') { if ($textarea.val() !== '') {
if (!window.confirm('Are you sure you want to cancel creating this comment?')) { if (!window.confirm(__('Are you sure you want to cancel creating this comment?'))) {
return; return;
} }
} }
...@@ -265,7 +266,7 @@ export default class Notes { ...@@ -265,7 +266,7 @@ export default class Notes {
originalText = $textarea.closest('form').data('originalNote'); originalText = $textarea.closest('form').data('originalNote');
newText = $textarea.val(); newText = $textarea.val();
if (originalText !== newText) { if (originalText !== newText) {
if (!window.confirm('Are you sure you want to cancel editing this comment?')) { if (!window.confirm(__('Are you sure you want to cancel editing this comment?'))) {
return; return;
} }
} }
...@@ -636,7 +637,7 @@ export default class Notes { ...@@ -636,7 +637,7 @@ export default class Notes {
this.glForm = new GLForm(form, enableGFM); this.glForm = new GLForm(form, enableGFM);
textarea = form.find('.js-note-text'); textarea = form.find('.js-note-text');
key = [ key = [
'Note', s__('NoteForm|Note'),
form.find('#note_noteable_type').val(), form.find('#note_noteable_type').val(),
form.find('#note_noteable_id').val(), form.find('#note_noteable_id').val(),
form.find('#note_commit_id').val(), form.find('#note_commit_id').val(),
...@@ -670,7 +671,9 @@ export default class Notes { ...@@ -670,7 +671,9 @@ export default class Notes {
formParentTimeline = $form.closest('.discussion-notes').find('.notes'); formParentTimeline = $form.closest('.discussion-notes').find('.notes');
} }
return this.addFlash( return this.addFlash(
'Your comment could not be submitted! Please check your network connection and try again.', __(
'Your comment could not be submitted! Please check your network connection and try again.',
),
'alert', 'alert',
formParentTimeline.get(0), formParentTimeline.get(0),
); );
...@@ -679,7 +682,7 @@ export default class Notes { ...@@ -679,7 +682,7 @@ export default class Notes {
updateNoteError($parentTimeline) { updateNoteError($parentTimeline) {
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Flash( new Flash(
'Your comment could not be updated! Please check your network connection and try again.', __('Your comment could not be updated! Please check your network connection and try again.'),
); );
} }
...@@ -1259,11 +1262,11 @@ export default class Notes { ...@@ -1259,11 +1262,11 @@ export default class Notes {
putConflictEditWarningInPlace(noteEntity, $note) { putConflictEditWarningInPlace(noteEntity, $note) {
if ($note.find('.js-conflict-edit-warning').length === 0) { if ($note.find('.js-conflict-edit-warning').length === 0) {
const $alert = $(`<div class="js-conflict-edit-warning alert alert-danger"> const $alert = $(`<div class="js-conflict-edit-warning alert alert-danger">
This comment has changed since you started editing, please review the ${__('This comment has changed since you started editing, please review the')}
<a href="#note_${noteEntity.id}" target="_blank" rel="noopener noreferrer"> <a href="#note_${noteEntity.id}" target="_blank" rel="noopener noreferrer">
updated comment ${__('updated comment')}
</a> </a>
to ensure information is not lost ${__('to ensure information is not lost')}
</div>`); </div>`);
$alert.insertAfter($note.find('.note-text')); $alert.insertAfter($note.find('.note-text'));
} }
...@@ -1491,13 +1494,13 @@ export default class Notes { ...@@ -1491,13 +1494,13 @@ export default class Notes {
if (executedCommands && executedCommands.length) { if (executedCommands && executedCommands.length) {
if (executedCommands.length > 1) { if (executedCommands.length > 1) {
tempFormContent = 'Applying multiple commands'; tempFormContent = __('Applying multiple commands');
} else { } else {
const commandDescription = executedCommands[0].description.toLowerCase(); const commandDescription = executedCommands[0].description.toLowerCase();
tempFormContent = `Applying command to ${commandDescription}`; tempFormContent = __(`Applying command to ${commandDescription}`);
} }
} else { } else {
tempFormContent = 'Applying command'; tempFormContent = __('Applying command');
} }
return tempFormContent; return tempFormContent;
...@@ -1817,7 +1820,9 @@ export default class Notes { ...@@ -1817,7 +1820,9 @@ export default class Notes {
$editingNote $editingNote
.find('.note-headline-meta a') .find('.note-headline-meta a')
.html( .html(
'<i class="fa fa-spinner fa-spin" aria-label="Comment is being updated" aria-hidden="true"></i>', `<i class="fa fa-spinner fa-spin" aria-label="${__(
'Comment is being updated',
)}" aria-hidden="true"></i>`,
); );
// Make request to update comment on server // Make request to update comment on server
......
...@@ -982,6 +982,9 @@ msgstr "" ...@@ -982,6 +982,9 @@ msgstr ""
msgid "Any encrypted tokens" msgid "Any encrypted tokens"
msgstr "" msgstr ""
msgid "Any namespace"
msgstr ""
msgid "Appearance" msgid "Appearance"
msgstr "" msgstr ""
...@@ -1069,6 +1072,12 @@ msgstr "" ...@@ -1069,6 +1072,12 @@ msgstr ""
msgid "Are you sure that you want to unarchive this project?" msgid "Are you sure that you want to unarchive this project?"
msgstr "" msgstr ""
msgid "Are you sure you want to cancel creating this comment?"
msgstr ""
msgid "Are you sure you want to cancel editing this comment?"
msgstr ""
msgid "Are you sure you want to delete this list?" msgid "Are you sure you want to delete this list?"
msgstr "" msgstr ""
...@@ -1453,6 +1462,27 @@ msgstr "" ...@@ -1453,6 +1462,27 @@ msgstr ""
msgid "BranchSwitcherTitle|Switch branch" msgid "BranchSwitcherTitle|Switch branch"
msgstr "" msgstr ""
msgid "BranchValidation|can't be"
msgstr ""
msgid "BranchValidation|can't contain"
msgstr ""
msgid "BranchValidation|can't end in"
msgstr ""
msgid "BranchValidation|can't start with"
msgstr ""
msgid "BranchValidation|consecutive slashes"
msgstr ""
msgid "BranchValidation|or"
msgstr ""
msgid "BranchValidation|spaces"
msgstr ""
msgid "Branches" msgid "Branches"
msgstr "" msgstr ""
...@@ -2587,6 +2617,9 @@ msgstr "" ...@@ -2587,6 +2617,9 @@ msgstr ""
msgid "Comment form position" msgid "Comment form position"
msgstr "" msgstr ""
msgid "Comment is being updated"
msgstr ""
msgid "Comments" msgid "Comments"
msgstr "" msgstr ""
...@@ -6399,6 +6432,9 @@ msgstr "" ...@@ -6399,6 +6432,9 @@ msgstr ""
msgid "Note: Consider asking your GitLab administrator to configure %{github_integration_link}, which will allow login via GitHub and allow importing repositories without generating a Personal Access Token." msgid "Note: Consider asking your GitLab administrator to configure %{github_integration_link}, which will allow login via GitHub and allow importing repositories without generating a Personal Access Token."
msgstr "" msgstr ""
msgid "NoteForm|Note"
msgstr ""
msgid "Notes|Are you sure you want to cancel creating this comment?" msgid "Notes|Are you sure you want to cancel creating this comment?"
msgstr "" msgstr ""
...@@ -9697,6 +9733,9 @@ msgstr "" ...@@ -9697,6 +9733,9 @@ msgstr ""
msgid "This branch has changed since you started editing. Would you like to create a new branch?" msgid "This branch has changed since you started editing. Would you like to create a new branch?"
msgstr "" msgstr ""
msgid "This comment has changed since you started editing, please review the"
msgstr ""
msgid "This commit is part of merge request %{link_to_merge_request}. Comments created here will be created in the context of that merge request." msgid "This commit is part of merge request %{link_to_merge_request}. Comments created here will be created in the context of that merge request."
msgstr "" msgstr ""
...@@ -11290,6 +11329,12 @@ msgstr "" ...@@ -11290,6 +11329,12 @@ msgstr ""
msgid "Your changes have been successfully committed." msgid "Your changes have been successfully committed."
msgstr "" msgstr ""
msgid "Your comment could not be submitted! Please check your network connection and try again."
msgstr ""
msgid "Your comment could not be updated! Please check your network connection and try again."
msgstr ""
msgid "Your comment will not be visible to the public." msgid "Your comment will not be visible to the public."
msgstr "" msgstr ""
...@@ -11878,12 +11923,18 @@ msgstr "" ...@@ -11878,12 +11923,18 @@ msgstr ""
msgid "this document" msgid "this document"
msgstr "" msgstr ""
msgid "to ensure information is not lost"
msgstr ""
msgid "triggered" msgid "triggered"
msgstr "" msgstr ""
msgid "updated" msgid "updated"
msgstr "" msgstr ""
msgid "updated comment"
msgstr ""
msgid "username" msgid "username"
msgstr "" 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