Commit ed8dc177 authored by Brandon Labuschagne's avatar Brandon Labuschagne

I18N JS files starting with i

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 f7bba29c
...@@ -4,6 +4,7 @@ import $ from 'jquery'; ...@@ -4,6 +4,7 @@ import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import Flash from './flash'; import Flash from './flash';
import { __ } from './locale';
export default { export default {
init({ container, form, issues, prefixId } = {}) { init({ container, form, issues, prefixId } = {}) {
...@@ -32,7 +33,7 @@ export default { ...@@ -32,7 +33,7 @@ export default {
onFormSubmitFailure() { onFormSubmitFailure() {
this.form.find('[type="submit"]').enable(); this.form.find('[type="submit"]').enable();
return new Flash('Issue update failed'); return new Flash(__('Issue update failed'));
}, },
getSelectedIssues() { getSelectedIssues() {
......
import $ from 'jquery'; import $ from 'jquery';
import axios from './lib/utils/axios_utils'; import axios from './lib/utils/axios_utils';
import flash from './flash'; import flash from './flash';
import { __ } from './locale'; import { s__, __ } from './locale';
import IssuableBulkUpdateSidebar from './issuable_bulk_update_sidebar'; import IssuableBulkUpdateSidebar from './issuable_bulk_update_sidebar';
import IssuableBulkUpdateActions from './issuable_bulk_update_actions'; import IssuableBulkUpdateActions from './issuable_bulk_update_actions';
...@@ -29,7 +29,7 @@ export default class IssuableIndex { ...@@ -29,7 +29,7 @@ export default class IssuableIndex {
$resetToken.on('click', e => { $resetToken.on('click', e => {
e.preventDefault(); e.preventDefault();
$resetToken.text('resetting...'); $resetToken.text(s__('EmailToken|resetting...'));
axios axios
.put($resetToken.attr('href')) .put($resetToken.attr('href'))
...@@ -38,12 +38,12 @@ export default class IssuableIndex { ...@@ -38,12 +38,12 @@ export default class IssuableIndex {
.val(data.new_address) .val(data.new_address)
.focus(); .focus();
$resetToken.text('reset it'); $resetToken.text(s__('EmailToken|reset it'));
}) })
.catch(() => { .catch(() => {
flash(__('There was an error when reseting email token.')); flash(__('There was an error when reseting email token.'));
$resetToken.text('reset it'); $resetToken.text(s__('EmailToken|reset it'));
}); });
}); });
} }
......
...@@ -7,6 +7,7 @@ import flash from './flash'; ...@@ -7,6 +7,7 @@ import flash from './flash';
import TaskList from './task_list'; import TaskList from './task_list';
import CreateMergeRequestDropdown from './create_merge_request_dropdown'; import CreateMergeRequestDropdown from './create_merge_request_dropdown';
import IssuablesHelper from './helpers/issuables_helper'; import IssuablesHelper from './helpers/issuables_helper';
import { __ } from './locale';
export default class Issue { export default class Issue {
constructor() { constructor() {
...@@ -44,7 +45,11 @@ export default class Issue { ...@@ -44,7 +45,11 @@ export default class Issue {
* @param {Array} data * @param {Array} data
* @param {String} issueFailMessage * @param {String} issueFailMessage
*/ */
updateTopState(isClosed, data, issueFailMessage = 'Unable to update this issue at this time.') { updateTopState(
isClosed,
data,
issueFailMessage = __('Unable to update this issue at this time.'),
) {
if ('id' in data) { if ('id' in data) {
const isClosedBadge = $('div.status-box-issue-closed'); const isClosedBadge = $('div.status-box-issue-closed');
const isOpenBadge = $('div.status-box-open'); const isOpenBadge = $('div.status-box-open');
...@@ -81,7 +86,7 @@ export default class Issue { ...@@ -81,7 +86,7 @@ export default class Issue {
} }
initIssueBtnEventListeners() { initIssueBtnEventListeners() {
const issueFailMessage = 'Unable to update this issue at this time.'; const issueFailMessage = __('Unable to update this issue at this time.');
return $(document).on( return $(document).on(
'click', 'click',
...@@ -152,6 +157,6 @@ export default class Issue { ...@@ -152,6 +157,6 @@ export default class Issue {
$container.html(data.html); $container.html(data.html);
} }
}) })
.catch(() => flash('Failed to load related branches')); .catch(() => flash(__('Failed to load related branches')));
} }
} }
import $ from 'jquery'; import $ from 'jquery';
import { __ } from './locale';
export default function issueStatusSelect() { export default function issueStatusSelect() {
$('.js-issue-status').each((i, el) => { $('.js-issue-status').each((i, el) => {
...@@ -7,7 +8,7 @@ export default function issueStatusSelect() { ...@@ -7,7 +8,7 @@ export default function issueStatusSelect() {
selectable: true, selectable: true,
fieldName, fieldName,
toggleLabel(selected, element, instance) { toggleLabel(selected, element, instance) {
let label = 'Author'; let label = __('Author');
const $item = instance.dropdown.find('.is-active'); const $item = instance.dropdown.find('.is-active');
if ($item.length) { if ($item.length) {
label = $item.text(); label = $item.text();
......
...@@ -3560,6 +3560,12 @@ msgstr "" ...@@ -3560,6 +3560,12 @@ msgstr ""
msgid "EmailError|Your account has been blocked. If you believe this is in error, contact a staff member." msgid "EmailError|Your account has been blocked. If you believe this is in error, contact a staff member."
msgstr "" msgstr ""
msgid "EmailToken|reset it"
msgstr ""
msgid "EmailToken|resetting..."
msgstr ""
msgid "Emails" msgid "Emails"
msgstr "" msgstr ""
...@@ -4142,6 +4148,9 @@ msgstr "" ...@@ -4142,6 +4148,9 @@ msgstr ""
msgid "Failed to load errors from Sentry. Error message: %{errorMessage}" msgid "Failed to load errors from Sentry. Error message: %{errorMessage}"
msgstr "" msgstr ""
msgid "Failed to load related branches"
msgstr ""
msgid "Failed to promote label due to internal error. Please contact administrators." msgid "Failed to promote label due to internal error. Please contact administrators."
msgstr "" msgstr ""
...@@ -5145,6 +5154,9 @@ msgstr "" ...@@ -5145,6 +5154,9 @@ msgstr ""
msgid "Issue events" msgid "Issue events"
msgstr "" msgstr ""
msgid "Issue update failed"
msgstr ""
msgid "IssueBoards|Board" msgid "IssueBoards|Board"
msgstr "" msgstr ""
...@@ -10151,6 +10163,9 @@ msgstr "" ...@@ -10151,6 +10163,9 @@ msgstr ""
msgid "Unable to schedule a pipeline to run immediately" msgid "Unable to schedule a pipeline to run immediately"
msgstr "" msgstr ""
msgid "Unable to update this issue at this time."
msgstr ""
msgid "Unarchive project" msgid "Unarchive project"
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