Commit 0f919c1a authored by Clement Ho's avatar Clement Ho

Merge branch 'js-i18n-filtered-search' into 'master'

Internationalisation of filtered_search directory

See merge request gitlab-org/gitlab-ce!27678
parents 2cf486bb 1d10ea6a
import { __ } from '~/locale';
export default IssuableTokenKeys => {
const wipToken = {
key: 'wip',
......@@ -5,7 +7,7 @@ export default IssuableTokenKeys => {
param: '',
symbol: '',
icon: 'admin',
tag: 'Yes or No',
tag: __('Yes or No'),
lowercaseValueOnSubmit: true,
uppercaseTokenName: true,
capitalizeTokenValue: true,
......
......@@ -3,6 +3,7 @@ import Ajax from '../droplab/plugins/ajax';
import Filter from '../droplab/plugins/filter';
import FilteredSearchDropdown from './filtered_search_dropdown';
import DropdownUtils from './dropdown_utils';
import { __ } from '~/locale';
export default class DropdownEmoji extends FilteredSearchDropdown {
constructor(options = {}) {
......@@ -14,7 +15,7 @@ export default class DropdownEmoji extends FilteredSearchDropdown {
loadingTemplate: this.loadingTemplate,
onError() {
/* eslint-disable no-new */
new Flash('An error occurred fetching the dropdown data.');
new Flash(__('An error occurred fetching the dropdown data.'));
/* eslint-enable no-new */
},
},
......
......@@ -3,6 +3,7 @@ import Ajax from '../droplab/plugins/ajax';
import Filter from '../droplab/plugins/filter';
import FilteredSearchDropdown from './filtered_search_dropdown';
import DropdownUtils from './dropdown_utils';
import { __ } from '~/locale';
export default class DropdownNonUser extends FilteredSearchDropdown {
constructor(options = {}) {
......@@ -17,7 +18,7 @@ export default class DropdownNonUser extends FilteredSearchDropdown {
preprocessing,
onError() {
/* eslint-disable no-new */
new Flash('An error occurred fetching the dropdown data.');
new Flash(__('An error occurred fetching the dropdown data.'));
/* eslint-enable no-new */
},
},
......
......@@ -14,6 +14,7 @@ import FilteredSearchTokenizer from './filtered_search_tokenizer';
import FilteredSearchDropdownManager from './filtered_search_dropdown_manager';
import FilteredSearchVisualTokens from './filtered_search_visual_tokens';
import DropdownUtils from './dropdown_utils';
import { __ } from '~/locale';
export default class FilteredSearchManager {
constructor({
......@@ -64,7 +65,7 @@ export default class FilteredSearchManager {
.catch(error => {
if (error.name === 'RecentSearchesServiceError') return undefined;
// eslint-disable-next-line no-new
new Flash('An error occurred while parsing recent searches');
new Flash(__('An error occurred while parsing recent searches'));
// Gracefully fail to empty array
return [];
})
......@@ -340,7 +341,7 @@ export default class FilteredSearchManager {
handleInputPlaceholder() {
const query = DropdownUtils.getSearchQuery();
const placeholder = 'Search or filter results...';
const placeholder = __('Search or filter results...');
const currentPlaceholder = this.filteredSearchInput.placeholder;
if (query.length === 0 && currentPlaceholder !== placeholder) {
......
import { __ } from '~/locale';
export default class FilteredSearchTokenKeys {
constructor(tokenKeys = [], alternativeTokenKeys = [], conditions = []) {
this.tokenKeys = tokenKeys;
......@@ -79,7 +81,7 @@ export default class FilteredSearchTokenKeys {
param: '',
symbol: '',
icon: 'eye-slash',
tag: 'Yes or No',
tag: __('Yes or No'),
lowercaseValueOnSubmit: true,
uppercaseTokenName: false,
capitalizeTokenValue: true,
......
import FilteredSearchTokenKeys from './filtered_search_token_keys';
import { __ } from '~/locale';
export const tokenKeys = [
{
......@@ -60,52 +61,52 @@ export const conditions = [
{
url: 'assignee_id=None',
tokenKey: 'assignee',
value: 'None',
value: __('None'),
},
{
url: 'assignee_id=Any',
tokenKey: 'assignee',
value: 'Any',
value: __('Any'),
},
{
url: 'milestone_title=None',
tokenKey: 'milestone',
value: 'None',
value: __('None'),
},
{
url: 'milestone_title=Any',
tokenKey: 'milestone',
value: 'Any',
value: __('Any'),
},
{
url: 'milestone_title=%23upcoming',
tokenKey: 'milestone',
value: 'Upcoming',
value: __('Upcoming'),
},
{
url: 'milestone_title=%23started',
tokenKey: 'milestone',
value: 'Started',
value: __('Started'),
},
{
url: 'label_name[]=None',
tokenKey: 'label',
value: 'None',
value: __('None'),
},
{
url: 'label_name[]=Any',
tokenKey: 'label',
value: 'Any',
value: __('Any'),
},
{
url: 'my_reaction_emoji=None',
tokenKey: 'my-reaction',
value: 'None',
value: __('None'),
},
{
url: 'my_reaction_emoji=Any',
tokenKey: 'my-reaction',
value: 'Any',
value: __('Any'),
},
];
......
import { __ } from '~/locale';
class RecentSearchesServiceError {
constructor(message) {
this.name = 'RecentSearchesServiceError';
this.message = message || 'Recent Searches Service is unavailable';
this.message = message || __('Recent Searches Service is unavailable');
}
}
......
......@@ -5,6 +5,7 @@ import AjaxCache from '~/lib/utils/ajax_cache';
import DropdownUtils from '~/filtered_search/dropdown_utils';
import Flash from '~/flash';
import UsersCache from '~/lib/utils/users_cache';
import { __ } from '~/locale';
export default class VisualTokenValue {
constructor(tokenValue, tokenType) {
......@@ -77,7 +78,7 @@ export default class VisualTokenValue {
matchingLabel.text_color,
);
})
.catch(() => new Flash('An error occurred while fetching label colors.'));
.catch(() => new Flash(__('An error occurred while fetching label colors.')));
}
static setTokenStyle(tokenValueContainer, backgroundColor, textColor) {
......
......@@ -810,6 +810,9 @@ msgstr ""
msgid "An error occurred while dismissing the feature highlight. Refresh the page and try dismissing again."
msgstr ""
msgid "An error occurred while fetching label colors."
msgstr ""
msgid "An error occurred while fetching markdown preview"
msgstr ""
......@@ -855,6 +858,9 @@ msgstr ""
msgid "An error occurred while making the request."
msgstr ""
msgid "An error occurred while parsing recent searches"
msgstr ""
msgid "An error occurred while rendering KaTeX"
msgstr ""
......@@ -7519,6 +7525,9 @@ msgstr ""
msgid "Recent Project Activity"
msgstr ""
msgid "Recent Searches Service is unavailable"
msgstr ""
msgid "Recent searches"
msgstr ""
......@@ -10584,6 +10593,9 @@ msgstr ""
msgid "Yes"
msgstr ""
msgid "Yes or No"
msgstr ""
msgid "Yes, add it"
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