Commit bc1f9f95 authored by Brandon Labuschagne's avatar Brandon Labuschagne

I18N EE JS files in directories starting with p

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 dbf63dda
......@@ -2,6 +2,7 @@
import $ from 'jquery';
import Api from '~/api';
import { sprintf, __ } from '~/locale';
function AdminEmailSelect() {
import(/* webpackChunkName: 'select2' */ 'select2/select2')
......@@ -12,7 +13,7 @@ function AdminEmailSelect() {
var skip_ldap;
skip_ldap = $(select).hasClass('skip_ldap');
return $(select).select2({
placeholder: 'Select group or project',
placeholder: __('Select group or project'),
multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0,
query: function(query) {
......@@ -77,17 +78,19 @@ AdminEmailSelect.prototype.formatResult = function(object) {
'</div> </div>'
);
} else {
return "<div class='group-result'> <div class='group-name'>All</div> <div class='group-path'>All groups and projects</div> </div>";
return `<div class='group-result'> <div class='group-name'>${__(
'All',
)}</div> <div class='group-path'>${__('All groups and projects')}</div> </div>`;
}
};
AdminEmailSelect.prototype.formatSelection = function(object) {
if (object.path_with_namespace) {
return 'Project: ' + object.name;
return sprintf(__('Project: %{name}'), { name: object.name });
} else if (object.path) {
return 'Group: ' + object.name;
return sprintf(__('Group: %{name}'), { name: object.name });
} else {
return 'All groups and projects';
return __('All groups and projects');
}
};
......
......@@ -3,7 +3,7 @@
import _ from 'underscore';
import axios from '~/lib/utils/axios_utils';
import Flash from '~/flash';
import { n__ } from '~/locale';
import { n__, s__, __ } from '~/locale';
import { LEVEL_TYPES, LEVEL_ID_PROP, ACCESS_LEVEL_NONE } from './constants';
export default class AccessDropdown {
......@@ -295,7 +295,7 @@ export default class AccessDropdown {
this.groupsData = groupsResponse;
callback(this.consolidateData(usersResponse.data, groupsResponse.data));
})
.catch(() => Flash('Failed to load groups & users.'));
.catch(() => Flash(__('Failed to load groups & users.')));
}
consolidateData(usersResponse, groupsResponse) {
......@@ -369,7 +369,7 @@ export default class AccessDropdown {
});
if (roles.length) {
consolidatedData = consolidatedData.concat([{ header: 'Roles' }], roles);
consolidatedData = consolidatedData.concat([{ header: s__('AccessDropdown|Roles') }], roles);
}
if (groups.length) {
......@@ -377,11 +377,18 @@ export default class AccessDropdown {
consolidatedData = consolidatedData.concat(['divider']);
}
consolidatedData = consolidatedData.concat([{ header: 'Groups' }], groups);
consolidatedData = consolidatedData.concat(
[{ header: s__('AccessDropdown|Groups') }],
groups,
);
}
if (users.length) {
consolidatedData = consolidatedData.concat(['divider'], [{ header: 'Users' }], users);
consolidatedData = consolidatedData.concat(
['divider'],
[{ header: s__('AccessDropdown|Users') }],
users,
);
}
return consolidatedData;
......
......@@ -5,6 +5,7 @@ import Flash from '~/flash';
import CreateItemDropdown from '~/create_item_dropdown';
import AccessDropdown from 'ee/projects/settings/access_dropdown';
import { ACCESS_LEVELS, LEVEL_TYPES } from './constants';
import { __ } from '~/locale';
export default class ProtectedBranchCreate {
constructor() {
......@@ -45,7 +46,7 @@ export default class ProtectedBranchCreate {
this.createItemDropdown = new CreateItemDropdown({
$dropdown: this.$form.find('.js-protected-branch-select'),
defaultToggleLabel: 'Protected Branch',
defaultToggleLabel: __('Protected Branch'),
fieldName: 'protected_branch[name]',
onSelect: this.onSelectCallback,
getData: ProtectedBranchCreate.getProtectedBranches,
......@@ -111,6 +112,6 @@ export default class ProtectedBranchCreate {
.then(() => {
window.location.reload();
})
.catch(() => Flash('Failed to protect the branch'));
.catch(() => Flash(__('Failed to protect the branch')));
}
}
......@@ -4,6 +4,7 @@ import axios from '~/lib/utils/axios_utils';
import Flash from '~/flash';
import AccessDropdown from 'ee/projects/settings/access_dropdown';
import { ACCESS_LEVELS, LEVEL_TYPES } from './constants';
import { __ } from '~/locale';
export default class ProtectedBranchEdit {
constructor(options) {
......@@ -84,7 +85,7 @@ export default class ProtectedBranchEdit {
.catch(() => {
this.$allowedToMergeDropdown.enable();
this.$allowedToPushDropdown.enable();
Flash('Failed to update branch!', null, $('.js-protected-branches-list'));
Flash(__('Failed to update branch!'), null, $('.js-protected-branches-list'));
});
}
......
......@@ -5,6 +5,7 @@ import Flash from '~/flash';
import CreateItemDropdown from '~/create_item_dropdown';
import AccessDropdown from 'ee/projects/settings/access_dropdown';
import { ACCESS_LEVELS, LEVEL_TYPES } from './constants';
import { __ } from '~/locale';
const PROTECTED_ENVIRONMENT_INPUT = 'input[name="protected_environment[name]"]';
......@@ -37,7 +38,7 @@ export default class ProtectedEnvironmentCreate {
this.createItemDropdown = new CreateItemDropdown({
$dropdown: this.$form.find('.js-protected-environment-select'),
defaultToggleLabel: 'Protected Environment',
defaultToggleLabel: __('Protected Environment'),
fieldName: 'protected_environment[name]',
onSelect: this.onSelectCallback,
getData: ProtectedEnvironmentCreate.getProtectedEnvironments,
......@@ -66,7 +67,7 @@ export default class ProtectedEnvironmentCreate {
callback(results);
})
.catch(() => {
Flash('An error occurred while fetching environments.');
Flash(__('An error occurred while fetching environments.'));
callback([]);
});
}
......@@ -114,6 +115,6 @@ export default class ProtectedEnvironmentCreate {
window.location.hash = 'js-protected-environments-settings';
window.location.reload();
})
.catch(() => Flash('Failed to protect the environment'));
.catch(() => Flash(__('Failed to protect the environment')));
}
}
......@@ -4,6 +4,7 @@ import axios from '~/lib/utils/axios_utils';
import Flash from '~/flash';
import AccessDropdown from 'ee/projects/settings/access_dropdown';
import { ACCESS_LEVELS, LEVEL_TYPES } from './constants';
import { __ } from '~/locale';
export default class ProtectedEnvironmentEdit {
constructor(options) {
......@@ -69,7 +70,7 @@ export default class ProtectedEnvironmentEdit {
})
.catch(() => {
this.$allowedToDeployDropdown.enable();
Flash('Failed to update environment!', null, $('.js-protected-environments-list'));
Flash(__('Failed to update environment!'), null, $('.js-protected-environments-list'));
});
}
......
......@@ -2,7 +2,7 @@ import $ from 'jquery';
import axios from '~/lib/utils/axios_utils';
import createFlash from '~/flash';
import CreateItemDropdown from '~/create_item_dropdown';
import { s__ } from '~/locale';
import { s__, __ } from '~/locale';
import AccessDropdown from 'ee/projects/settings/access_dropdown';
import { ACCESS_LEVELS, LEVEL_TYPES } from './constants';
......@@ -35,7 +35,7 @@ export default class ProtectedTagCreate {
// Protected tag dropdown
this.createItemDropdown = new CreateItemDropdown({
$dropdown: this.$form.find('.js-protected-tag-select'),
defaultToggleLabel: 'Protected Tag',
defaultToggleLabel: __('Protected Tag'),
fieldName: 'protected_tag[name]',
onSelect: this.onSelectCallback,
getData: ProtectedTagCreate.getProtectedTags,
......
......@@ -606,6 +606,15 @@ msgstr ""
msgid "Access to '%{classification_label}' not allowed"
msgstr ""
msgid "AccessDropdown|Groups"
msgstr ""
msgid "AccessDropdown|Roles"
msgstr ""
msgid "AccessDropdown|Users"
msgstr ""
msgid "Account"
msgstr ""
......@@ -947,6 +956,9 @@ msgstr ""
msgid "All features are enabled for blank projects, from templates, or when importing, but you can disable them afterward in the project settings."
msgstr ""
msgid "All groups and projects"
msgstr ""
msgid "All issues for this milestone are closed. You may close this milestone now."
msgstr ""
......@@ -1094,6 +1106,9 @@ msgstr ""
msgid "An error occurred while enabling Service Desk."
msgstr ""
msgid "An error occurred while fetching environments."
msgstr ""
msgid "An error occurred while fetching folder content."
msgstr ""
......@@ -5284,12 +5299,21 @@ msgstr ""
msgid "Failed to load errors from Sentry. Error message: %{errorMessage}"
msgstr ""
msgid "Failed to load groups & users."
msgstr ""
msgid "Failed to load related branches"
msgstr ""
msgid "Failed to promote label due to internal error. Please contact administrators."
msgstr ""
msgid "Failed to protect the branch"
msgstr ""
msgid "Failed to protect the environment"
msgstr ""
msgid "Failed to remove issue from board, please try again."
msgstr ""
......@@ -5329,6 +5353,9 @@ msgstr ""
msgid "Failed to update branch!"
msgstr ""
msgid "Failed to update environment!"
msgstr ""
msgid "Failed to update issues, please try again."
msgstr ""
......@@ -6372,6 +6399,9 @@ msgstr ""
msgid "Group: %{group_name}"
msgstr ""
msgid "Group: %{name}"
msgstr ""
msgid "GroupRoadmap|From %{dateWord}"
msgstr ""
......@@ -10014,6 +10044,9 @@ msgstr ""
msgid "Project:"
msgstr ""
msgid "Project: %{name}"
msgstr ""
msgid "ProjectActivityRSS|Subscribe"
msgstr ""
......@@ -10404,6 +10437,9 @@ msgstr ""
msgid "Protected Branch"
msgstr ""
msgid "Protected Environment"
msgstr ""
msgid "Protected Environments"
msgstr ""
......@@ -11471,6 +11507,9 @@ msgstr ""
msgid "Select branch/tag"
msgstr ""
msgid "Select group or project"
msgstr ""
msgid "Select members to invite"
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