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