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'; ...@@ -3,7 +3,7 @@ import $ from 'jquery';
import _ from 'underscore'; import _ from 'underscore';
import { GlLoadingIcon, GlButton, GlAvatar } from '@gitlab/ui'; import { GlLoadingIcon, GlButton, GlAvatar } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import { sprintf, n__, s__, __ } from '~/locale'; import { n__, s__, __ } from '~/locale';
import Api from '~/api'; import Api from '~/api';
import { renderAvatar, renderIdenticon } from '~/helpers/avatar_helper'; import { renderAvatar, renderIdenticon } from '~/helpers/avatar_helper';
...@@ -49,16 +49,17 @@ export default { ...@@ -49,16 +49,17 @@ export default {
}, },
computed: { computed: {
selectedProjectsLabel() { selectedProjectsLabel() {
return this.selectedProjects.length if (this.selectedProjects.length > 1) {
? sprintf( return n__(
n__( 'CycleAnalytics|%d project selected',
'CycleAnalytics|%{projectName}', 'CycleAnalytics|%d projects selected',
'CycleAnalytics|%d projects selected', this.selectedProjects.length,
this.selectedProjects.length, );
), } else if (this.selectedProjects.length === 1) {
{ projectName: this.selectedProjects[0].name }, return this.selectedProjects[0].name;
) }
: this.selectedProjectsPlaceholder;
return this.selectedProjectsPlaceholder;
}, },
selectedProjectsPlaceholder() { selectedProjectsPlaceholder() {
return this.multiSelect ? __('Select projects') : __('Select a project'); return this.multiSelect ? __('Select projects') : __('Select a project');
......
...@@ -5742,7 +5742,7 @@ msgstr "" ...@@ -5742,7 +5742,7 @@ msgstr ""
msgid "CycleAnalyticsStage|should be under a group" msgid "CycleAnalyticsStage|should be under a group"
msgstr "" msgstr ""
msgid "CycleAnalytics|%{projectName}" msgid "CycleAnalytics|%d project selected"
msgid_plural "CycleAnalytics|%d projects selected" msgid_plural "CycleAnalytics|%d projects selected"
msgstr[0] "" msgstr[0] ""
msgstr[1] "" 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