summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEzekiel Kigbo <ekigbo@gitlab.com>2019-07-18 19:12:49 +1000
committerEzekiel Kigbo <ekigbo@gitlab.com>2019-07-24 11:07:26 +1000
commit4250245fe4dedb3da2fec4a183e658c19348c2f9 (patch)
tree27a284942668fe7b6492c2bdc6ef6b9f87b21f4c
parentd4eb6995b7f8d87f65390d30e6a75c890d304f9a (diff)
downloadgitlab-ce-63553-remove-pluralize-in-favour-of-n__.tar.gz
Minor refactor pluralizations63553-remove-pluralize-in-favour-of-n__
Use the '%d' variable within content pluralized using n__ instead of relying on template literals
-rw-r--r--app/assets/javascripts/commits.js3
-rw-r--r--app/assets/javascripts/diffs/components/diff_gutter_avatars.vue6
-rw-r--r--app/assets/javascripts/lib/utils/datetime_utility.js16
-rw-r--r--locale/gitlab.pot25
4 files changed, 17 insertions, 33 deletions
diff --git a/app/assets/javascripts/commits.js b/app/assets/javascripts/commits.js
index 014dd685038..7dd75d03ab9 100644
--- a/app/assets/javascripts/commits.js
+++ b/app/assets/javascripts/commits.js
@@ -90,9 +90,10 @@ export default class CommitsList {
.first()
.find('li.commit').length,
);
+
$commitsHeadersLast
.find('span.commits-count')
- .text(`${commitsCount} ${n__('commit', 'commits', commitsCount)}`);
+ .text(n__('%d commit', '%d commits', commitsCount));
}
localTimeAgo($processedData.find('.js-timeago'));
diff --git a/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue b/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue
index b0b6cecf8fc..7ede7a4f430 100644
--- a/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue
+++ b/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue
@@ -43,11 +43,7 @@ export default {
return '';
}
- return n__(
- `${this.moreCount} more comment`,
- `${this.moreCount} more comments`,
- this.moreCount,
- );
+ return n__('%d more comment', '%d more comments', this.moreCount);
},
},
methods: {
diff --git a/app/assets/javascripts/lib/utils/datetime_utility.js b/app/assets/javascripts/lib/utils/datetime_utility.js
index 779b7d9fc14..a4715789337 100644
--- a/app/assets/javascripts/lib/utils/datetime_utility.js
+++ b/app/assets/javascripts/lib/utils/datetime_utility.js
@@ -230,18 +230,10 @@ export const timeIntervalInWords = intervalInSeconds => {
const secondsInteger = parseInt(intervalInSeconds, 10);
const minutes = Math.floor(secondsInteger / 60);
const seconds = secondsInteger - minutes * 60;
- let text = '';
-
- if (minutes >= 1) {
- text = `${minutes} ${n__('minute', 'minutes', minutes)} ${seconds} ${n__(
- 'second',
- 'seconds',
- seconds,
- )}`;
- } else {
- text = `${seconds} ${n__('second', 'seconds', seconds)}`;
- }
- return text;
+ const secondsText = n__('%d second', '%d seconds', seconds);
+ return minutes >= 1
+ ? [n__('%d minute', '%d minutes', minutes), secondsText].join(' ')
+ : secondsText;
};
export const dateInWords = (date, abbreviated = false, hideYear = false) => {
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 8039a027661..c9937a39dd7 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -95,11 +95,21 @@ msgid_plural "%d metrics"
msgstr[0] ""
msgstr[1] ""
+msgid "%d minute"
+msgid_plural "%d minutes"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "%d more comment"
msgid_plural "%d more comments"
msgstr[0] ""
msgstr[1] ""
+msgid "%d second"
+msgid_plural "%d seconds"
+msgstr[0] ""
+msgstr[1] ""
+
msgid "%d staged change"
msgid_plural "%d staged changes"
msgstr[0] ""
@@ -12753,11 +12763,6 @@ msgstr ""
msgid "commented on %{link_to_project}"
msgstr ""
-msgid "commit"
-msgid_plural "commits"
-msgstr[0] ""
-msgstr[1] ""
-
msgid "commit %{commit_id}"
msgstr ""
@@ -12933,11 +12938,6 @@ msgstr[1] ""
msgid "milestone should belong either to a project or a group."
msgstr ""
-msgid "minute"
-msgid_plural "minutes"
-msgstr[0] ""
-msgstr[1] ""
-
msgid "missing"
msgstr ""
@@ -13262,11 +13262,6 @@ msgstr[1] ""
msgid "score"
msgstr ""
-msgid "second"
-msgid_plural "seconds"
-msgstr[0] ""
-msgstr[1] ""
-
msgid "should be greater than or equal to %{access} inherited membership from group %{group_name}"
msgstr ""