Commit 6a9b6c22 authored by Brandon Labuschagne's avatar Brandon Labuschagne Committed by Kushal Pandya

Internationalisation of blob directory

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 2432a540
import Flash from '../flash'; import Flash from '../flash';
import BalsamiqViewer from './balsamiq/balsamiq_viewer'; import BalsamiqViewer from './balsamiq/balsamiq_viewer';
import { __ } from '~/locale';
function onError() { function onError() {
const flash = new Flash('Balsamiq file could not be loaded.'); const flash = new Flash(__('Balsamiq file could not be loaded.'));
return flash; return flash;
} }
......
...@@ -5,6 +5,7 @@ import Dropzone from 'dropzone'; ...@@ -5,6 +5,7 @@ import Dropzone from 'dropzone';
import { visitUrl } from '../lib/utils/url_utility'; import { visitUrl } from '../lib/utils/url_utility';
import { HIDDEN_CLASS } from '../lib/utils/constants'; import { HIDDEN_CLASS } from '../lib/utils/constants';
import csrf from '../lib/utils/csrf'; import csrf from '../lib/utils/csrf';
import { sprintf, __ } from '~/locale';
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
...@@ -73,7 +74,7 @@ export default class BlobFileDropzone { ...@@ -73,7 +74,7 @@ export default class BlobFileDropzone {
.html(errorMessage) .html(errorMessage)
.text(); .text();
$('.dropzone-alerts') $('.dropzone-alerts')
.html(`Error uploading file: "${stripped}"`) .html(sprintf(__('Error uploading file: %{stripped}'), { stripped }))
.show(); .show();
this.removeFile(file); this.removeFile(file);
}, },
...@@ -84,7 +85,7 @@ export default class BlobFileDropzone { ...@@ -84,7 +85,7 @@ export default class BlobFileDropzone {
e.stopPropagation(); e.stopPropagation();
if (dropzone[0].dropzone.getQueuedFiles().length === 0) { if (dropzone[0].dropzone.getQueuedFiles().length === 0) {
// eslint-disable-next-line no-alert // eslint-disable-next-line no-alert
alert('Please select a file'); alert(__('Please select a file'));
return false; return false;
} }
toggleLoading(submitButton, submitButtonLoadingIcon, true); toggleLoading(submitButton, submitButtonLoadingIcon, true);
......
import JSZip from 'jszip'; import JSZip from 'jszip';
import JSZipUtils from 'jszip-utils'; import JSZipUtils from 'jszip-utils';
import { __ } from '~/locale';
export default class SketchLoader { export default class SketchLoader {
constructor(container) { constructor(container) {
...@@ -56,10 +57,10 @@ export default class SketchLoader { ...@@ -56,10 +57,10 @@ export default class SketchLoader {
const errorMsg = document.createElement('p'); const errorMsg = document.createElement('p');
errorMsg.className = 'prepend-top-default append-bottom-default text-center'; errorMsg.className = 'prepend-top-default append-bottom-default text-center';
errorMsg.textContent = ` errorMsg.textContent = __(`
Cannot show preview. For previews on sketch files, they must have the file format Cannot show preview. For previews on sketch files, they must have the file format
introduced by Sketch version 43 and above. introduced by Sketch version 43 and above.
`; `);
this.container.appendChild(errorMsg); this.container.appendChild(errorMsg);
this.removeLoadingIcon(); this.removeLoadingIcon();
......
import FileTemplateSelector from '../file_template_selector'; import FileTemplateSelector from '../file_template_selector';
import { __ } from '~/locale';
export default class DockerfileSelector extends FileTemplateSelector { export default class DockerfileSelector extends FileTemplateSelector {
constructor({ mediator }) { constructor({ mediator }) {
super(mediator); super(mediator);
this.config = { this.config = {
key: 'dockerfile', key: 'dockerfile',
name: 'Dockerfile', name: __('Dockerfile'),
pattern: /(Dockerfile)/, pattern: /(Dockerfile)/,
type: 'dockerfiles', type: 'dockerfiles',
dropdown: '.js-dockerfile-selector', dropdown: '.js-dockerfile-selector',
......
...@@ -2,6 +2,7 @@ import $ from 'jquery'; ...@@ -2,6 +2,7 @@ import $ from 'jquery';
import Flash from '../../flash'; import Flash from '../../flash';
import { handleLocationHash } from '../../lib/utils/common_utils'; import { handleLocationHash } from '../../lib/utils/common_utils';
import axios from '../../lib/utils/axios_utils'; import axios from '../../lib/utils/axios_utils';
import { __ } from '~/locale';
export default class BlobViewer { export default class BlobViewer {
constructor() { constructor() {
...@@ -26,7 +27,7 @@ export default class BlobViewer { ...@@ -26,7 +27,7 @@ export default class BlobViewer {
promise promise
.then(module => module.default(viewer)) .then(module => module.default(viewer))
.catch(error => { .catch(error => {
Flash('Error loading file viewer.'); Flash(__('Error loading file viewer.'));
throw error; throw error;
}); });
...@@ -106,16 +107,19 @@ export default class BlobViewer { ...@@ -106,16 +107,19 @@ export default class BlobViewer {
if (!this.copySourceBtn) return; if (!this.copySourceBtn) return;
if (this.simpleViewer.getAttribute('data-loaded')) { if (this.simpleViewer.getAttribute('data-loaded')) {
this.copySourceBtn.setAttribute('title', 'Copy source to clipboard'); this.copySourceBtn.setAttribute('title', __('Copy source to clipboard'));
this.copySourceBtn.classList.remove('disabled'); this.copySourceBtn.classList.remove('disabled');
} else if (this.activeViewer === this.simpleViewer) { } else if (this.activeViewer === this.simpleViewer) {
this.copySourceBtn.setAttribute( this.copySourceBtn.setAttribute(
'title', 'title',
'Wait for the source to load to copy it to the clipboard', __('Wait for the source to load to copy it to the clipboard'),
); );
this.copySourceBtn.classList.add('disabled'); this.copySourceBtn.classList.add('disabled');
} else { } else {
this.copySourceBtn.setAttribute('title', 'Switch to the source to copy it to the clipboard'); this.copySourceBtn.setAttribute(
'title',
__('Switch to the source to copy it to the clipboard'),
);
this.copySourceBtn.classList.add('disabled'); this.copySourceBtn.classList.add('disabled');
} }
...@@ -158,7 +162,7 @@ export default class BlobViewer { ...@@ -158,7 +162,7 @@ export default class BlobViewer {
this.toggleCopyButtonState(); this.toggleCopyButtonState();
}) })
.catch(() => new Flash('Error loading viewer')); .catch(() => new Flash(__('Error loading viewer')));
} }
static loadViewer(viewerParam) { static loadViewer(viewerParam) {
......
...@@ -1296,6 +1296,9 @@ msgstr "" ...@@ -1296,6 +1296,9 @@ msgstr ""
msgid "Badges|e.g. %{exampleUrl}" msgid "Badges|e.g. %{exampleUrl}"
msgstr "" msgstr ""
msgid "Balsamiq file could not be loaded."
msgstr ""
msgid "BambooService|A continuous integration and build server" msgid "BambooService|A continuous integration and build server"
msgstr "" msgstr ""
...@@ -1614,6 +1617,9 @@ msgstr "" ...@@ -1614,6 +1617,9 @@ msgstr ""
msgid "Cannot render the image. Maximum character count (%{charLimit}) has been exceeded." msgid "Cannot render the image. Maximum character count (%{charLimit}) has been exceeded."
msgstr "" msgstr ""
msgid "Cannot show preview. For previews on sketch files, they must have the file format introduced by Sketch version 43 and above."
msgstr ""
msgid "Cannot skip two factor authentication setup" msgid "Cannot skip two factor authentication setup"
msgstr "" msgstr ""
...@@ -2714,6 +2720,9 @@ msgstr "" ...@@ -2714,6 +2720,9 @@ msgstr ""
msgid "Copy secret to clipboard" msgid "Copy secret to clipboard"
msgstr "" msgstr ""
msgid "Copy source to clipboard"
msgstr ""
msgid "Copy to clipboard" msgid "Copy to clipboard"
msgstr "" msgstr ""
...@@ -3292,6 +3301,9 @@ msgstr "" ...@@ -3292,6 +3301,9 @@ msgstr ""
msgid "Do you want to customize how Google Code email addresses and usernames are imported into GitLab?" msgid "Do you want to customize how Google Code email addresses and usernames are imported into GitLab?"
msgstr "" msgstr ""
msgid "Dockerfile"
msgstr ""
msgid "Domain" msgid "Domain"
msgstr "" msgstr ""
...@@ -3709,6 +3721,9 @@ msgstr "" ...@@ -3709,6 +3721,9 @@ msgstr ""
msgid "Error loading branches." msgid "Error loading branches."
msgstr "" msgstr ""
msgid "Error loading file viewer."
msgstr ""
msgid "Error loading last commit." msgid "Error loading last commit."
msgstr "" msgstr ""
...@@ -3727,6 +3742,9 @@ msgstr "" ...@@ -3727,6 +3742,9 @@ msgstr ""
msgid "Error loading template." msgid "Error loading template."
msgstr "" msgstr ""
msgid "Error loading viewer"
msgstr ""
msgid "Error occurred when toggling the notification subscription" msgid "Error occurred when toggling the notification subscription"
msgstr "" msgstr ""
...@@ -3760,6 +3778,9 @@ msgstr "" ...@@ -3760,6 +3778,9 @@ msgstr ""
msgid "Error uploading file" msgid "Error uploading file"
msgstr "" msgstr ""
msgid "Error uploading file: %{stripped}"
msgstr ""
msgid "Error while loading the merge request. Please try again." msgid "Error while loading the merge request. Please try again."
msgstr "" msgstr ""
...@@ -6658,6 +6679,9 @@ msgstr "" ...@@ -6658,6 +6679,9 @@ msgstr ""
msgid "Please note that this application is not provided by GitLab and you should verify its authenticity before allowing access." msgid "Please note that this application is not provided by GitLab and you should verify its authenticity before allowing access."
msgstr "" msgstr ""
msgid "Please select a file"
msgstr ""
msgid "Please select a group." msgid "Please select a group."
msgstr "" msgstr ""
...@@ -8725,6 +8749,9 @@ msgstr "" ...@@ -8725,6 +8749,9 @@ msgstr ""
msgid "Switch to GitLab Next" msgid "Switch to GitLab Next"
msgstr "" msgstr ""
msgid "Switch to the source to copy it to the clipboard"
msgstr ""
msgid "System Hooks" msgid "System Hooks"
msgstr "" msgstr ""
...@@ -10240,6 +10267,9 @@ msgstr "" ...@@ -10240,6 +10267,9 @@ msgstr ""
msgid "VisibilityLevel|Unknown" msgid "VisibilityLevel|Unknown"
msgstr "" msgstr ""
msgid "Wait for the source to load to copy it to the clipboard"
msgstr ""
msgid "Want to see the data? Please ask an administrator for access." msgid "Want to see the data? Please ask an administrator for access."
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