summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Labuschagne <blabuschagne@gitlab.com>2019-05-17 13:07:23 +0200
committerBrandon Labuschagne <blabuschagne@gitlab.com>2019-05-17 13:07:23 +0200
commit0d605b4d04fc9f4fb9a688b297843aaf2b460205 (patch)
tree12457b31bac1e21b765a317d26d98fac0880c343
parentfa7bf979dfbdf4c34717c7fddaf856405ea9e9ca (diff)
downloadgitlab-ce-js-i18n-c-d.tar.gz
Refactor plural based stringjs-i18n-c-d
-rw-r--r--app/assets/javascripts/dropzone_input.js14
-rw-r--r--locale/gitlab.pot9
2 files changed, 7 insertions, 16 deletions
diff --git a/app/assets/javascripts/dropzone_input.js b/app/assets/javascripts/dropzone_input.js
index 1b32443f1d8..0ff26445a6a 100644
--- a/app/assets/javascripts/dropzone_input.js
+++ b/app/assets/javascripts/dropzone_input.js
@@ -4,7 +4,7 @@ import _ from 'underscore';
import './behaviors/preview_markdown';
import csrf from './lib/utils/csrf';
import axios from './lib/utils/axios_utils';
-import { sprintf, __ } from '~/locale';
+import { n__, __ } from '~/locale';
Dropzone.autoDiscover = false;
@@ -274,19 +274,11 @@ export default function dropzoneInput(form) {
};
updateAttachingMessage = (files, messageContainer) => {
- let attachingMessage;
const filesCount = files.filter(file => file.status === 'uploading' || file.status === 'queued')
.length;
+ const attachingMessage = n__('Attaching a file', 'Attaching %d files', filesCount);
- // Dinamycally change uploading files text depending on files number in
- // dropzone files queue.
- if (filesCount > 1) {
- attachingMessage = sprintf(__('Attaching %{filesCount} files -'), { filesCount });
- } else {
- attachingMessage = __('Attaching a file -');
- }
-
- messageContainer.text(attachingMessage);
+ messageContainer.text(`${attachingMessage} -`);
};
form.find('.markdown-selector').click(function onMarkdownClick(e) {
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index b0e9a1ab8f6..1be4d110011 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -1186,11 +1186,10 @@ msgstr ""
msgid "Attach a file by drag &amp; drop or %{upload_link}"
msgstr ""
-msgid "Attaching %{filesCount} files -"
-msgstr ""
-
-msgid "Attaching a file -"
-msgstr ""
+msgid "Attaching a file"
+msgid_plural "Attaching %d files"
+msgstr[0] ""
+msgstr[1] ""
msgid "Attaching the file failed."
msgstr ""