Merge branch 'js-i18n-blob' into 'master'

Internationalisation of blob directory

See merge request gitlab-org/gitlab-ce!27670
This commit is contained in:
Kushal Pandya 2019-04-30 17:21:40 +00:00
commit 4e20743232
6 changed files with 49 additions and 11 deletions

View file

@ -1,8 +1,9 @@
import Flash from '../flash';
import BalsamiqViewer from './balsamiq/balsamiq_viewer';
import { __ } from '~/locale';
function onError() {
const flash = new Flash('Balsamiq file could not be loaded.');
const flash = new Flash(__('Balsamiq file could not be loaded.'));
return flash;
}

View file

@ -5,6 +5,7 @@ import Dropzone from 'dropzone';
import { visitUrl } from '../lib/utils/url_utility';
import { HIDDEN_CLASS } from '../lib/utils/constants';
import csrf from '../lib/utils/csrf';
import { sprintf, __ } from '~/locale';
Dropzone.autoDiscover = false;
@ -73,7 +74,7 @@ export default class BlobFileDropzone {
.html(errorMessage)
.text();
$('.dropzone-alerts')
.html(`Error uploading file: "${stripped}"`)
.html(sprintf(__('Error uploading file: %{stripped}'), { stripped }))
.show();
this.removeFile(file);
},
@ -84,7 +85,7 @@ export default class BlobFileDropzone {
e.stopPropagation();
if (dropzone[0].dropzone.getQueuedFiles().length === 0) {
// eslint-disable-next-line no-alert
alert('Please select a file');
alert(__('Please select a file'));
return false;
}
toggleLoading(submitButton, submitButtonLoadingIcon, true);

View file

@ -1,5 +1,6 @@
import JSZip from 'jszip';
import JSZipUtils from 'jszip-utils';
import { __ } from '~/locale';
export default class SketchLoader {
constructor(container) {
@ -56,10 +57,10 @@ export default class SketchLoader {
const errorMsg = document.createElement('p');
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
introduced by Sketch version 43 and above.
`;
`);
this.container.appendChild(errorMsg);
this.removeLoadingIcon();

View file

@ -1,11 +1,12 @@
import FileTemplateSelector from '../file_template_selector';
import { __ } from '~/locale';
export default class DockerfileSelector extends FileTemplateSelector {
constructor({ mediator }) {
super(mediator);
this.config = {
key: 'dockerfile',
name: 'Dockerfile',
name: __('Dockerfile'),
pattern: /(Dockerfile)/,
type: 'dockerfiles',
dropdown: '.js-dockerfile-selector',

View file

@ -2,6 +2,7 @@ import $ from 'jquery';
import Flash from '../../flash';
import { handleLocationHash } from '../../lib/utils/common_utils';
import axios from '../../lib/utils/axios_utils';
import { __ } from '~/locale';
export default class BlobViewer {
constructor() {
@ -26,7 +27,7 @@ export default class BlobViewer {
promise
.then(module => module.default(viewer))
.catch(error => {
Flash('Error loading file viewer.');
Flash(__('Error loading file viewer.'));
throw error;
});
@ -106,16 +107,19 @@ export default class BlobViewer {
if (!this.copySourceBtn) return;
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');
} else if (this.activeViewer === this.simpleViewer) {
this.copySourceBtn.setAttribute(
'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');
} 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');
}
@ -158,7 +162,7 @@ export default class BlobViewer {
this.toggleCopyButtonState();
})
.catch(() => new Flash('Error loading viewer'));
.catch(() => new Flash(__('Error loading viewer')));
}
static loadViewer(viewerParam) {

View file

@ -1296,6 +1296,9 @@ msgstr ""
msgid "Badges|e.g. %{exampleUrl}"
msgstr ""
msgid "Balsamiq file could not be loaded."
msgstr ""
msgid "BambooService|A continuous integration and build server"
msgstr ""
@ -1614,6 +1617,9 @@ msgstr ""
msgid "Cannot render the image. Maximum character count (%{charLimit}) has been exceeded."
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"
msgstr ""
@ -2714,6 +2720,9 @@ msgstr ""
msgid "Copy secret to clipboard"
msgstr ""
msgid "Copy source to clipboard"
msgstr ""
msgid "Copy to clipboard"
msgstr ""
@ -3292,6 +3301,9 @@ msgstr ""
msgid "Do you want to customize how Google Code email addresses and usernames are imported into GitLab?"
msgstr ""
msgid "Dockerfile"
msgstr ""
msgid "Domain"
msgstr ""
@ -3709,6 +3721,9 @@ msgstr ""
msgid "Error loading branches."
msgstr ""
msgid "Error loading file viewer."
msgstr ""
msgid "Error loading last commit."
msgstr ""
@ -3727,6 +3742,9 @@ msgstr ""
msgid "Error loading template."
msgstr ""
msgid "Error loading viewer"
msgstr ""
msgid "Error occurred when toggling the notification subscription"
msgstr ""
@ -3760,6 +3778,9 @@ msgstr ""
msgid "Error uploading file"
msgstr ""
msgid "Error uploading file: %{stripped}"
msgstr ""
msgid "Error while loading the merge request. Please try again."
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."
msgstr ""
msgid "Please select a file"
msgstr ""
msgid "Please select a group."
msgstr ""
@ -8725,6 +8749,9 @@ msgstr ""
msgid "Switch to GitLab Next"
msgstr ""
msgid "Switch to the source to copy it to the clipboard"
msgstr ""
msgid "System Hooks"
msgstr ""
@ -10240,6 +10267,9 @@ msgstr ""
msgid "VisibilityLevel|Unknown"
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."
msgstr ""