I18N of JS files starting with g

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
This commit is contained in:
Brandon Labuschagne 2019-05-02 16:36:20 +02:00
parent 112193e8a6
commit 0b38e0a247
4 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import $ from 'jquery';
import { __ } from '~/locale';
/**
* This class overrides the browser's validation error bubbles, displaying custom
@ -61,7 +62,7 @@ export default class GlFieldError {
this.inputElement = $(input);
this.inputDomElement = this.inputElement.get(0);
this.form = formErrors;
this.errorMessage = this.inputElement.attr('title') || 'This field is required.';
this.errorMessage = this.inputElement.attr('title') || __('This field is required.');
this.fieldErrorElement = $(`<p class='${errorMessageClass} hidden'>${this.errorMessage}</p>`);
this.state = {

View File

@ -20,7 +20,7 @@ export default class GpgBadges {
const endpoint = tag.data('signaturesPath');
if (!endpoint) {
displayError();
return Promise.reject(new Error('Missing commit signatures endpoint!'));
return Promise.reject(new Error(__('Missing commit signatures endpoint!')));
}
const params = parseQueryStringIntoObject(tag.serialize());

View File

@ -2,6 +2,7 @@ import $ from 'jquery';
import axios from './lib/utils/axios_utils';
import Api from './api';
import { normalizeHeaders } from './lib/utils/common_utils';
import { __ } from '~/locale';
export default function groupsSelect() {
import(/* webpackChunkName: 'select2' */ 'select2/select2')
@ -18,7 +19,7 @@ export default function groupsSelect() {
: Api.groupsPath;
$select.select2({
placeholder: 'Search for a group',
placeholder: __('Search for a group'),
allowClear: $select.hasClass('allowClear'),
multiple: $select.hasClass('multiselect'),
minimumInputLength: 0,

View File

@ -6058,6 +6058,9 @@ msgstr ""
msgid "Mirroring settings were successfully updated."
msgstr ""
msgid "Missing commit signatures endpoint!"
msgstr ""
msgid "MissingSSHKeyWarningLink|add an SSH key"
msgstr ""
@ -8376,6 +8379,9 @@ msgstr ""
msgid "Search files"
msgstr ""
msgid "Search for a group"
msgstr ""
msgid "Search for projects, issues, etc."
msgstr ""