A platform for community discussion. Free, open, simple.
I18N: Add pluralization for chat rewind, bulk tagging & post deleted msg (#37255)
moin-Janac1f64eaaad67
diff --git a/app/jobs/regular/delete_user_posts.rb b/app/jobs/regular/delete_user_posts.rbindex 7df7ad80c74..19a6e06bc65 100644--- a/app/jobs/regular/delete_user_posts.rb+++ b/app/jobs/regular/delete_user_posts.rb@@ -28,7 +28,7 @@ module Jobs:user_posts_deleted,user: user.username,staff_user: acting_user.username,- deleted_posts_count: deleted_count,+ count: deleted_count,)post&.topic&.invite_group(acting_user, Group[:admins])diff --git a/app/services/tags/bulk_create.rb b/app/services/tags/bulk_create.rbindex 17d567d7a9f..ca72f9785a7 100644--- a/app/services/tags/bulk_create.rb+++ b/app/services/tags/bulk_create.rb@@ -28,7 +28,7 @@ class Tags::BulkCreatevalidates :tag_names,length: {maximum: 100,- message: ->(object, data) { I18n.t("tags.bulk_create.too_many_tags", max: 100) },+ message: ->(object, data) { I18n.t("tags.bulk_create.too_many_tags", count: 100) },},if: -> { tag_names.present? }@@ -72,7 +72,7 @@ class Tags::BulkCreateif normalized_input.length > SiteSetting.max_tag_lengthresults[:failed][raw_name] = I18n.t("tags.bulk_create.tag_too_long",- max: SiteSetting.max_tag_length,+ count: SiteSetting.max_tag_length,)nextenddiff --git a/config/locales/server.en.yml b/config/locales/server.en.ymlindex 79d1668db5c..39ac09c7d89 100644--- a/config/locales/server.en.yml+++ b/config/locales/server.en.yml@@ -4111,8 +4111,9 @@ en:user_posts_deleted:title: "User Posts Deleted"subject_template: "All of %{user}'s posts have been deleted"- text_body_template: |- %{deleted_posts_count} posts from @%{user} have been deleted by @%{staff_user}.+ text_body_template:+ one: "%{count} post from @%{user} has been deleted by @%{staff_user}."+ other: "%{count} posts from @%{user} have been deleted by @%{staff_user}."unsubscribe_link: |To unsubscribe from these emails, [click here](%{unsubscribe_url}).@@ -5486,8 +5487,12 @@ en:bulk_create:invalid_params: "Invalid parameters. Please provide an array of tag names."invalid_name: "Invalid tag name."- tag_too_long: "Tag is too long (max %{max} characters)."- too_many_tags: "Too many tags. You can create up to %{max} tags at once. For larger imports, use the CSV upload feature."+ tag_too_long:+ one: "Tag is too long (max %{count} character)."+ other: "Tag is too long (max %{count} characters)."+ too_many_tags:+ one: "Too many tags. You can create up to %{count} tag at once. For larger imports, use the CSV upload feature."+ other: "Too many tags. You can create up to %{count} tags at once. For larger imports, use the CSV upload feature."forbidden:invalid:one: "The tag you selected cannot be used"diff --git a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjsindex 6fd9cd0a656..19b33124e04 100644--- a/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs+++ b/plugins/discourse-rewind/assets/javascripts/discourse/components/reports/chat-usage.gjs@@ -4,7 +4,7 @@ import { htmlSafe } from "@ember/template";import avatar from "discourse/helpers/avatar";import number from "discourse/helpers/number";import getURL from "discourse/lib/get-url";-import { i18n } from "discourse-i18n";+import I18n, { i18n } from "discourse-i18n";import { i18nForOwner } from "discourse/plugins/discourse-rewind/discourse/lib/rewind-i18n";const BotMessage = <template>@@ -67,10 +67,13 @@ export default class ChatUsage extends Component {}get message2Text() {- return i18n("discourse_rewind.reports.chat_usage.message_2", {- dm_count: this.args.report.data.dm_message_count,- channel_count: this.args.report.data.unique_dm_channels,- });+ return I18n.messageFormat(+ "discourse_rewind.reports.chat_usage.message_2_MF",+ {+ dm_count: this.args.report.data.dm_message_count,+ channel_count: this.args.report.data.unique_dm_channels,+ }+ );}get message3Text() {diff --git a/plugins/discourse-rewind/config/locales/client.en.yml b/plugins/discourse-rewind/config/locales/client.en.ymlindex b7724a223df..49376ffcab7 100644--- a/plugins/discourse-rewind/config/locales/client.en.yml+++ b/plugins/discourse-rewind/config/locales/client.en.yml@@ -129,11 +129,23 @@ en:author_others: "%{username}"channel_title: "#chat-activity"status_online: "● online"- message_1: "You sent <strong>%{count}</strong> messages this year!"+ message_1:+ one: "You sent <strong>%{count}</strong> message this year!"+ other: "You sent <strong>%{count}</strong> messages this year!"reply_1: "lol awesome B-)"- message_2: "You had <strong>%{dm_count}</strong> DM conversations with <strong>%{channel_count}</strong> different people or groups"+ # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines.+ message_2_MF: |+ You had { dm_count, plural,+ one {<strong>#</strong> DM conversation}+ other {<strong>#</strong> DM conversations}+ } with { channel_count, plural,+ one {<strong>#</strong> person or group}+ other {<strong>#</strong> different people or groups}+ }.reply_2: "cOo0oL :D"- message_3: "People loved your messages! You got <strong>%{count}</strong> reactions ❤️"+ message_3:+ one: "People loved your messages! You got <strong>%{count}</strong> reaction ❤️"+ other: "People loved your messages! You got <strong>%{count}</strong> reactions ❤️"reply_3: "r0fl rAwr 8-)"message_4: "Your average message length was <strong>%{length}</strong> characters"message_5: "Your favorite channels:"