From 5e7c38bb33f960bb047981a5b1b9f2ab1b503850 Mon Sep 17 00:00:00 2001 From: zubiden <19638254+zubiden@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:01:24 +0100 Subject: [PATCH] Localization: Add pluralization to some strings (#5526) --- src/assets/localization/fallback.strings | 11 ++++++----- src/components/middle/ActionMessage.tsx | 7 ++++--- src/types/language.d.ts | 10 +++++----- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/assets/localization/fallback.strings b/src/assets/localization/fallback.strings index 98734d4c4..5586bf9ea 100644 --- a/src/assets/localization/fallback.strings +++ b/src/assets/localization/fallback.strings @@ -1455,13 +1455,14 @@ "StarsReactionLink" = "https://telegram.org/tos/stars"; "MiniAppsMoreTabs_one" = "{botName} & {count} Other"; "MiniAppsMoreTabs_other" = "{botName} & {count} Others"; -"PrizeCredits" = "Your prize is {count} Stars."; +"PrizeCredits2_one" = "Your prize is {count} Star."; +"PrizeCredits2_other" = "Your prize is {count} Stars."; "ActionStarGiftTitle" = "{user} sent you a Gift for {count} Stars"; "ActionStarGiftOutTitle" = "You have sent a gift for {count} Stars"; -"ActionStarGiftOutDescription_one" = "{user} can display this gift on their profile or convert it to {count} Star."; -"ActionStarGiftOutDescription_other" = "{user} can display this gift on their profile or convert it to {count} Stars."; -"ActionStarGiftDescription_one" = "Add this gift to your profile or convert it to {count} Star."; -"ActionStarGiftDescription_other" = "Add this gift to your profile or convert it to {count} Stars."; +"ActionStarGiftOutDescription2_one" = "{user} can display this gift on their profile or convert it to {count} Star."; +"ActionStarGiftOutDescription2_other" = "{user} can display this gift on their profile or convert it to {count} Stars."; +"ActionStarGiftDescription2_one" = "Add this gift to your profile or convert it to {count} Star."; +"ActionStarGiftDescription2_other" = "Add this gift to your profile or convert it to {count} Stars."; "ActionStarGiftDisplaying" = "You kept this gift on your profile."; "ActionStarGiftOutDescriptionUpgrade" = "{user} can turn this gift to a unique collectible."; "ActionStarGiftDescriptionUpgrade" = "Tap “Unpack” to turn this gift to a unique collectible."; diff --git a/src/components/middle/ActionMessage.tsx b/src/components/middle/ActionMessage.tsx index e47b8e7a6..8f74c50b3 100644 --- a/src/components/middle/ActionMessage.tsx +++ b/src/components/middle/ActionMessage.tsx @@ -451,7 +451,7 @@ const ActionMessage: FC = ({ if (message.isOutgoing) { if (amountToConvert) { - return lang('ActionStarGiftOutDescription', { + return lang('ActionStarGiftOutDescription2', { user: targetUser || 'User', count: amountToConvert, }, { withNodes: true, pluralValue: amountToConvert }); @@ -484,7 +484,7 @@ const ActionMessage: FC = ({ } if (amountToConvert) { - return lang('ActionStarGiftDescription', { + return lang('ActionStarGiftDescription2', { count: amountToConvert, }, { withNodes: true, pluralValue: amountToConvert }); } @@ -638,12 +638,13 @@ const ActionMessage: FC = ({ {renderText(lang( - 'PrizeCredits', { + 'PrizeCredits2', { count: ( {formatInteger(message.content.action?.stars!)} ), }, { withNodes: true, + pluralValue: message.content.action?.stars!, }, ), ['simple_markdown'])} diff --git a/src/types/language.d.ts b/src/types/language.d.ts index d7cf31c44..ceceb8d42 100644 --- a/src/types/language.d.ts +++ b/src/types/language.d.ts @@ -1703,9 +1703,6 @@ export interface LangPairWithVariables { 'StarsReactionTerms': { 'link': V; }; - 'PrizeCredits': { - 'count': V; - }; 'ActionStarGiftTitle': { 'user': V; 'count': V; @@ -1952,11 +1949,14 @@ export interface LangPairPluralWithVariables { 'botName': V; 'count': V; }; - 'ActionStarGiftOutDescription': { + 'PrizeCredits2': { + 'count': V; + }; + 'ActionStarGiftOutDescription2': { 'user': V; 'count': V; }; - 'ActionStarGiftDescription': { + 'ActionStarGiftDescription2': { 'count': V; }; 'StarsSubscribeText': {