Commit 31b5afd6 authored by Josianne Hyson's avatar Josianne Hyson

Fix issue with project dropdown translation

The Chinese language has one plural form on Crowdin - so the tool in
able to specify how the translation should behave when a single project
is selected. This means that the translation process is failing when
importing the Chinese translations as there is no way to specify the
%{projectName} in the singular form.
parent 7fdfd9c1
......@@ -3,7 +3,7 @@ import $ from 'jquery';
import _ from 'underscore';
import { GlLoadingIcon, GlButton, GlAvatar } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';
import { sprintf, n__, s__, __ } from '~/locale';
import { n__, s__, __ } from '~/locale';
import Api from '~/api';
import { renderAvatar, renderIdenticon } from '~/helpers/avatar_helper';
......@@ -49,16 +49,17 @@ export default {
},
computed: {
selectedProjectsLabel() {
return this.selectedProjects.length
? sprintf(
n__(
'CycleAnalytics|%{projectName}',
'CycleAnalytics|%d projects selected',
this.selectedProjects.length,
),
{ projectName: this.selectedProjects[0].name },
)
: this.selectedProjectsPlaceholder;
if (this.selectedProjects.length > 1) {
return n__(
'CycleAnalytics|%d project selected',
'CycleAnalytics|%d projects selected',
this.selectedProjects.length,
);
} else if (this.selectedProjects.length === 1) {
return this.selectedProjects[0].name;
}
return this.selectedProjectsPlaceholder;
},
selectedProjectsPlaceholder() {
return this.multiSelect ? __('Select projects') : __('Select a project');
......
......@@ -5742,7 +5742,7 @@ msgstr ""
msgid "CycleAnalyticsStage|should be under a group"
msgstr ""
msgid "CycleAnalytics|%{projectName}"
msgid "CycleAnalytics|%d project selected"
msgid_plural "CycleAnalytics|%d projects selected"
msgstr[0] ""
msgstr[1] ""
......
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