Commit 353cc804 authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Filipa Lacerda

Internationalisation of javascript/s* directories

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

i18n documentation
https://docs.gitlab.com/ee/development/i18n/externalization.html
parent 10a1aaae
import $ from 'jquery'; import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import { __ } from '~/locale';
function isValidProjectId(id) { function isValidProjectId(id) {
return id > 0; return id > 0;
...@@ -40,7 +41,9 @@ class SidebarMoveIssue { ...@@ -40,7 +41,9 @@ class SidebarMoveIssue {
this.mediator this.mediator
.fetchAutocompleteProjects(searchTerm) .fetchAutocompleteProjects(searchTerm)
.then(callback) .then(callback)
.catch(() => new window.Flash('An error occurred while fetching projects autocomplete.')); .catch(
() => new window.Flash(__('An error occurred while fetching projects autocomplete.')),
);
}, },
renderRow: project => ` renderRow: project => `
<li> <li>
...@@ -72,7 +75,7 @@ class SidebarMoveIssue { ...@@ -72,7 +75,7 @@ class SidebarMoveIssue {
this.$confirmButton.disable().addClass('is-loading'); this.$confirmButton.disable().addClass('is-loading');
this.mediator.moveIssue().catch(() => { this.mediator.moveIssue().catch(() => {
window.Flash('An error occurred while moving the issue.'); window.Flash(__('An error occurred while moving the issue.'));
this.$confirmButton.enable().removeClass('is-loading'); this.$confirmButton.enable().removeClass('is-loading');
}); });
} }
......
...@@ -2,6 +2,7 @@ import { visitUrl } from '../lib/utils/url_utility'; ...@@ -2,6 +2,7 @@ import { visitUrl } from '../lib/utils/url_utility';
import Flash from '../flash'; import Flash from '../flash';
import Service from './services/sidebar_service'; import Service from './services/sidebar_service';
import Store from './stores/sidebar_store'; import Store from './stores/sidebar_store';
import { __ } from '~/locale';
export default class SidebarMediator { export default class SidebarMediator {
constructor(options) { constructor(options) {
...@@ -45,7 +46,7 @@ export default class SidebarMediator { ...@@ -45,7 +46,7 @@ export default class SidebarMediator {
.then(data => { .then(data => {
this.processFetchedData(data); this.processFetchedData(data);
}) })
.catch(() => new Flash('Error occurred when fetching sidebar data')); .catch(() => new Flash(__('Error occurred when fetching sidebar data')));
} }
processFetchedData(data) { processFetchedData(data) {
......
import { __ } from '~/locale';
export default () => { export default () => {
const { protocol, host, pathname } = window.location; const { protocol, host, pathname } = window.location;
const shareBtn = document.querySelector('.js-share-btn'); const shareBtn = document.querySelector('.js-share-btn');
...@@ -10,7 +12,7 @@ export default () => { ...@@ -10,7 +12,7 @@ export default () => {
shareBtn.classList.add('is-active'); shareBtn.classList.add('is-active');
embedBtn.classList.remove('is-active'); embedBtn.classList.remove('is-active');
snippetUrlArea.value = url; snippetUrlArea.value = url;
embedAction.innerText = 'Share'; embedAction.innerText = __('Share');
}); });
embedBtn.addEventListener('click', () => { embedBtn.addEventListener('click', () => {
...@@ -18,6 +20,6 @@ export default () => { ...@@ -18,6 +20,6 @@ export default () => {
shareBtn.classList.remove('is-active'); shareBtn.classList.remove('is-active');
const scriptTag = `<script src="${url}.js"></script>`; const scriptTag = `<script src="${url}.js"></script>`;
snippetUrlArea.value = scriptTag; snippetUrlArea.value = scriptTag;
embedAction.innerText = 'Embed'; embedAction.innerText = __('Embed');
}); });
}; };
...@@ -850,6 +850,9 @@ msgstr "" ...@@ -850,6 +850,9 @@ msgstr ""
msgid "An error occurred while fetching markdown preview" msgid "An error occurred while fetching markdown preview"
msgstr "" msgstr ""
msgid "An error occurred while fetching projects autocomplete."
msgstr ""
msgid "An error occurred while fetching sidebar data" msgid "An error occurred while fetching sidebar data"
msgstr "" msgstr ""
...@@ -895,6 +898,9 @@ msgstr "" ...@@ -895,6 +898,9 @@ msgstr ""
msgid "An error occurred while making the request." msgid "An error occurred while making the request."
msgstr "" msgstr ""
msgid "An error occurred while moving the issue."
msgstr ""
msgid "An error occurred while parsing recent searches" msgid "An error occurred while parsing recent searches"
msgstr "" msgstr ""
...@@ -3872,6 +3878,9 @@ msgstr "" ...@@ -3872,6 +3878,9 @@ msgstr ""
msgid "Error loading viewer" msgid "Error loading viewer"
msgstr "" msgstr ""
msgid "Error occurred when fetching sidebar data"
msgstr ""
msgid "Error occurred when toggling the notification subscription" msgid "Error occurred when toggling the notification subscription"
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