Localization: Update star related strings (#5800)

This commit is contained in:
zubiden 2025-04-23 18:58:56 +02:00 committed by Alexander Zinchuk
parent a6f8f232a8
commit e69a589432
7 changed files with 55 additions and 57 deletions

View File

@ -1866,27 +1866,26 @@
"SectionTitleStarsForForMessages" = "Set your price per message"; "SectionTitleStarsForForMessages" = "Set your price per message";
"SectionDescriptionStarsForForMessages" = "You will receive {percent}% of the selected fee (~{amount}) for each incoming message."; "SectionDescriptionStarsForForMessages" = "You will receive {percent}% of the selected fee (~{amount}) for each incoming message.";
"SubtitlePrivacyAddUsers" = "Add Users"; "SubtitlePrivacyAddUsers" = "Add Users";
"SubtitlePrivacyUsersCount" = "{count} users";
"PrivacyPaidMessagesValue" = "Paid"; "PrivacyPaidMessagesValue" = "Paid";
"FirstMessageInPaidMessagesChat" = "**{user}** charges {amount} for each message."; "FirstMessageInPaidMessagesChat" = "**{user}** charges {amount} for each message.";
"ButtonBuyStars" = "Buy Stars"; "ButtonBuyStars" = "Buy Stars";
"ComposerPlaceholderPaidMessage" = "Message for {amount}"; "ComposerPlaceholderPaidMessage" = "Message for {amount}";
"ComposerPlaceholderPaidReply" = "Reply for {amount}"; "ComposerPlaceholderPaidReply" = "Reply for {amount}";
"TitleConfirmPayment" = "Confirm Payment"; "TitleConfirmPayment" = "Confirm Payment";
"ConfirmationModalPaymentForOneMessage" = "{user} charges **{amount} Stars** per incoming message. Would you like to pay **{amount} Stars** to send one message?"; "ConfirmationModalPaymentForMessage_one" = "{user} charges **{amount}** per incoming message. Would you like to pay **{totalAmount}** to send one message?";
"ConfirmationModalPaymentForMessages" = "{user} charges **{price} Stars** per incoming message. Would you like to pay **{amount} Stars** to send **{count} messages?**"; "ConfirmationModalPaymentForMessage_other" = "{user} charges **{amount}** per incoming message. Would you like to pay **{totalAmount}** to send **{count} messages?**";
"ButtonPayForMessage" = "Pay for {count} message"; "PayForMessage_one" = "Pay for {count} message";
"ToastTitleMessageSent" = "Message sent!"; "PayForMessage_other" = "Pay for {count} messages";
"ToastTitleMessagesSent" = "{count} Messages sent!"; "MessageSentPaidToastTitle_one" = "Message sent!";
"ToastMessageSent" = "You paid {amount} stars."; "MessageSentPaidToastTitle_other" = "{count} messages sent!";
"MessageSentPaidToastText" = "You paid {amount}";
"ButtonUndo" = "Undo"; "ButtonUndo" = "Undo";
"ActionPaidOneMessageOutgoing" = "You paid {amount} Stars to send a message"; "ActionPaidOneMessageOutgoing" = "You paid {amount} to send a message";
"ActionPaidOneMessageIncoming" = "You received {amount} Stars from {user}"; "ActionPaidOneMessageIncoming" = "You received {amount} from {user}";
"PaneMessagePaidMessageCharge" = "{peer} must pay {amount} for each message to you."; "PaneMessagePaidMessageCharge" = "{peer} must pay {amount} for each message to you.";
"ConfirmRemoveMessageFee" = "Yes"; "ConfirmRemoveMessageFee" = "Yes";
"ConfirmDialogMessageRemoveFee" = "Are you sure you want to allow **{peer}** to message you for free?"; "ConfirmDialogMessageRemoveFee" = "Are you sure you want to allow **{peer}** to message you for free?";
"ConfirmDialogRemoveFeeRefundStars" = "Refund already paid **{amount} Stars**"; "ConfirmDialogRemoveFeeRefundStars" = "Refund already paid **{amount}**";
"DescriptionGiftPaidMessage" = "{user} charges **{amount}** Stars for each message. That price has been added to the cost of the gift.";
"StoryTooltipGifSent" = "Gif Sent!"; "StoryTooltipGifSent" = "Gif Sent!";
"StoryTooltipStickerSent" = "Sticker Sent!"; "StoryTooltipStickerSent" = "Sticker Sent!";
"StoryTooltipReactionSent" = "Reaction Sent!"; "StoryTooltipReactionSent" = "Reaction Sent!";

View File

@ -1,6 +1,8 @@
import type { FC, StateHookSetter } from '../../lib/teact/teact'; import type { FC, StateHookSetter } from '../../lib/teact/teact';
import React, { memo } from '../../lib/teact/teact'; import React, { memo } from '../../lib/teact/teact';
import { formatStarsAsText } from '../../util/localization/format';
import useLang from '../../hooks/useLang'; import useLang from '../../hooks/useLang';
import Checkbox from '../ui/Checkbox'; import Checkbox from '../ui/Checkbox';
@ -31,24 +33,20 @@ const PaymentMessageConfirmDialog: FC<OwnProps> = ({
}) => { }) => {
const lang = useLang(); const lang = useLang();
const confirmPaymentMessage = messagesCount === 1 ? lang('ConfirmationModalPaymentForOneMessage', { const confirmPaymentMessage = lang('ConfirmationModalPaymentForMessage', {
user: userName, user: userName,
amount: messagePriceInStars, amount: formatStarsAsText(lang, messagePriceInStars),
}, { totalAmount: formatStarsAsText(lang, messagePriceInStars * messagesCount),
withMarkdown: true,
withNodes: true,
}) : lang('ConfirmationModalPaymentForMessages', {
user: userName,
price: messagePriceInStars,
amount: messagePriceInStars * messagesCount,
count: messagesCount, count: messagesCount,
}, { }, {
withMarkdown: true, withMarkdown: true,
withNodes: true, withNodes: true,
pluralValue: messagesCount,
}); });
const confirmLabel = lang('ButtonPayForMessage', { count: messagesCount }, { const confirmLabel = lang('PayForMessage', { count: messagesCount }, {
withNodes: true, withNodes: true,
pluralValue: messagesCount,
}); });
return ( return (

View File

@ -23,6 +23,7 @@ import { selectSender } from '../../global/selectors';
import buildClassName from '../../util/buildClassName'; import buildClassName from '../../util/buildClassName';
import { formatHumanDate } from '../../util/dates/dateFormat'; import { formatHumanDate } from '../../util/dates/dateFormat';
import { compact } from '../../util/iteratees'; import { compact } from '../../util/iteratees';
import { formatStarsAsText } from '../../util/localization/format';
import { isAlbum } from './helpers/groupMessages'; import { isAlbum } from './helpers/groupMessages';
import { preventMessageInputBlur } from './helpers/preventMessageInputBlur'; import { preventMessageInputBlur } from './helpers/preventMessageInputBlur';
@ -154,14 +155,14 @@ const MessageListContent: FC<OwnProps> = ({
<span>{ <span>{
message.isOutgoing message.isOutgoing
? lang('ActionPaidOneMessageOutgoing', { ? lang('ActionPaidOneMessageOutgoing', {
amount, amount: formatStarsAsText(lang, amount),
}) })
: (() => { : (() => {
const sender = selectSender(getGlobal(), message); const sender = selectSender(getGlobal(), message);
const userTitle = sender ? getPeerTitle(lang, sender) : ''; const userTitle = sender ? getPeerTitle(lang, sender) : '';
return lang('ActionPaidOneMessageIncoming', { return lang('ActionPaidOneMessageIncoming', {
user: userTitle, user: userTitle,
amount, amount: formatStarsAsText(lang, amount),
}); });
})() })()
} }

View File

@ -6,6 +6,7 @@ import type { TabState } from '../../../../global/types';
import { getPeerTitle } from '../../../../global/helpers/peers'; import { getPeerTitle } from '../../../../global/helpers/peers';
import { selectUser } from '../../../../global/selectors'; import { selectUser } from '../../../../global/selectors';
import { formatStarsAsText } from '../../../../util/localization/format';
import useCurrentOrPrev from '../../../../hooks/useCurrentOrPrev'; import useCurrentOrPrev from '../../../../hooks/useCurrentOrPrev';
import useLang from '../../../../hooks/useLang'; import useLang from '../../../../hooks/useLang';
@ -61,7 +62,7 @@ const ChatRefundModal = ({ modal, user }: OwnProps & StateProps) => {
<Checkbox <Checkbox
className="dialog-checkbox" className="dialog-checkbox"
label={lang('ConfirmDialogRemoveFeeRefundStars', { label={lang('ConfirmDialogRemoveFeeRefundStars', {
amount: starsToRefund, amount: formatStarsAsText(lang, starsToRefund),
}, { }, {
withMarkdown: true, withMarkdown: true,
withNodes: true, withNodes: true,

View File

@ -17,6 +17,8 @@ import { ManagementProgress } from '../../../types';
import { BOT_FATHER_USERNAME, GENERAL_REFETCH_INTERVAL, PAID_SEND_DELAY } from '../../../config'; import { BOT_FATHER_USERNAME, GENERAL_REFETCH_INTERVAL, PAID_SEND_DELAY } from '../../../config';
import { copyTextToClipboard } from '../../../util/clipboard'; import { copyTextToClipboard } from '../../../util/clipboard';
import { getCurrentTabId } from '../../../util/establishMultitabRole'; import { getCurrentTabId } from '../../../util/establishMultitabRole';
import { getTranslationFn } from '../../../util/localization';
import { formatStarsAsText } from '../../../util/localization/format';
import { oldTranslate } from '../../../util/oldLangProvider'; import { oldTranslate } from '../../../util/oldLangProvider';
import PopupManager from '../../../util/PopupManager'; import PopupManager from '../../../util/PopupManager';
import requestActionTimeout from '../../../util/requestActionTimeout'; import requestActionTimeout from '../../../util/requestActionTimeout';
@ -437,8 +439,10 @@ addActionHandler('sendInlineBotResult', async (global, actions, payload): Promis
// eslint-disable-next-line eslint-multitab-tt/no-getactions-in-actions // eslint-disable-next-line eslint-multitab-tt/no-getactions-in-actions
actions.showNotification({ actions.showNotification({
localId: queryId, localId: queryId,
title: { key: 'ToastTitleMessageSent' }, title: { key: 'MessageSentPaidToastTitle', variables: { count: 1 }, options: { pluralValue: 1 } },
message: { key: 'ToastMessageSent', variables: { amount: starsForOneMessage } }, message: {
key: 'MessageSentPaidToastText', variables: { amount: formatStarsAsText(getTranslationFn(), starsForOneMessage) },
},
actionText: { key: 'ButtonUndo' }, actionText: { key: 'ButtonUndo' },
dismissAction: { dismissAction: {
action: 'sendInlineBotApiResult', action: 'sendInlineBotApiResult',

View File

@ -17,7 +17,6 @@ import type {
ThreadId, ThreadId,
} from '../../../types'; } from '../../../types';
import type { MessageKey } from '../../../util/keys/messageKey'; import type { MessageKey } from '../../../util/keys/messageKey';
import type { RegularLangFnParameters } from '../../../util/localization';
import type { RequiredGlobalActions } from '../../index'; import type { RequiredGlobalActions } from '../../index';
import type { import type {
ActionReturnType, GlobalState, TabArgs, ActionReturnType, GlobalState, TabArgs,
@ -50,6 +49,8 @@ import {
unique, unique,
} from '../../../util/iteratees'; } from '../../../util/iteratees';
import { getMessageKey, isLocalMessageId } from '../../../util/keys/messageKey'; import { getMessageKey, isLocalMessageId } from '../../../util/keys/messageKey';
import { getTranslationFn, type RegularLangFnParameters } from '../../../util/localization';
import { formatStarsAsText } from '../../../util/localization/format';
import { oldTranslate } from '../../../util/oldLangProvider'; import { oldTranslate } from '../../../util/oldLangProvider';
import { debounce, onTickEnd, rafPromise } from '../../../util/schedulers'; import { debounce, onTickEnd, rafPromise } from '../../../util/schedulers';
import { callApi, cancelApiProgress } from '../../../api/gramjs'; import { callApi, cancelApiProgress } from '../../../api/gramjs';
@ -1694,7 +1695,7 @@ async function sendMessagesWithNotification<T extends GlobalState>(
const { gif, sticker, isReaction } = firstSendParam; const { gif, sticker, isReaction } = firstSendParam;
if (gif) { if (gif) {
storySendMessage = { key: 'ToastTitleMessageSent' }; storySendMessage = { key: 'MessageSentPaidToastTitle', variables: { count: 1 }, options: { pluralValue: 1 } };
} else if (sticker) { } else if (sticker) {
storySendMessage = { key: 'StoryTooltipStickerSent' }; storySendMessage = { key: 'StoryTooltipStickerSent' };
} else if (isReaction) { } else if (isReaction) {
@ -1702,14 +1703,20 @@ async function sendMessagesWithNotification<T extends GlobalState>(
} }
} }
const titleKey: RegularLangFnParameters = storySendMessage || (messagesCount === 1 ? { key: 'ToastTitleMessageSent' } const titleKey: RegularLangFnParameters = storySendMessage || {
: { key: 'ToastTitleMessagesSent', variables: { count: messagesCount } }); key: 'MessageSentPaidToastTitle',
variables: { count: messagesCount },
options: { pluralValue: messagesCount },
};
// eslint-disable-next-line eslint-multitab-tt/no-getactions-in-actions // eslint-disable-next-line eslint-multitab-tt/no-getactions-in-actions
getActions().showNotification({ getActions().showNotification({
localId: getMessageKey(firstMessage), localId: getMessageKey(firstMessage),
title: titleKey, title: titleKey,
message: { key: 'ToastMessageSent', variables: { amount: starsForOneMessage * messagesCount } }, message: {
key: 'MessageSentPaidToastText',
variables: { amount: formatStarsAsText(getTranslationFn(), starsForOneMessage * messagesCount) },
},
actionText: { key: 'ButtonUndo' }, actionText: { key: 'ButtonUndo' },
action: { action: {
action: 'deleteMessages', action: 'deleteMessages',

View File

@ -1443,7 +1443,6 @@ export interface LangPair {
'PrivacyPaidMessagesValue': undefined; 'PrivacyPaidMessagesValue': undefined;
'ButtonBuyStars': undefined; 'ButtonBuyStars': undefined;
'TitleConfirmPayment': undefined; 'TitleConfirmPayment': undefined;
'ToastTitleMessageSent': undefined;
'ButtonUndo': undefined; 'ButtonUndo': undefined;
'ConfirmRemoveMessageFee': undefined; 'ConfirmRemoveMessageFee': undefined;
'StoryTooltipGifSent': undefined; 'StoryTooltipGifSent': undefined;
@ -2303,9 +2302,6 @@ export interface LangPairWithVariables<V extends unknown = LangVariable> {
'percent': V; 'percent': V;
'amount': V; 'amount': V;
}; };
'SubtitlePrivacyUsersCount': {
'count': V;
};
'FirstMessageInPaidMessagesChat': { 'FirstMessageInPaidMessagesChat': {
'user': V; 'user': V;
'amount': V; 'amount': V;
@ -2316,23 +2312,7 @@ export interface LangPairWithVariables<V extends unknown = LangVariable> {
'ComposerPlaceholderPaidReply': { 'ComposerPlaceholderPaidReply': {
'amount': V; 'amount': V;
}; };
'ConfirmationModalPaymentForOneMessage': { 'MessageSentPaidToastText': {
'user': V;
'amount': V;
};
'ConfirmationModalPaymentForMessages': {
'user': V;
'price': V;
'amount': V;
'count': V;
};
'ButtonPayForMessage': {
'count': V;
};
'ToastTitleMessagesSent': {
'count': V;
};
'ToastMessageSent': {
'amount': V; 'amount': V;
}; };
'ActionPaidOneMessageOutgoing': { 'ActionPaidOneMessageOutgoing': {
@ -2352,10 +2332,6 @@ export interface LangPairWithVariables<V extends unknown = LangVariable> {
'ConfirmDialogRemoveFeeRefundStars': { 'ConfirmDialogRemoveFeeRefundStars': {
'amount': V; 'amount': V;
}; };
'DescriptionGiftPaidMessage': {
'user': V;
'amount': V;
};
'PaidMessageTransactionDescription': { 'PaidMessageTransactionDescription': {
'percent': V; 'percent': V;
}; };
@ -2635,6 +2611,18 @@ export interface LangPairPluralWithVariables<V extends unknown = LangVariable> {
'from': V; 'from': V;
'count': V; 'count': V;
}; };
'ConfirmationModalPaymentForMessage': {
'user': V;
'amount': V;
'totalAmount': V;
'count': V;
};
'PayForMessage': {
'count': V;
};
'MessageSentPaidToastTitle': {
'count': V;
};
'PaidMessageTransaction': { 'PaidMessageTransaction': {
'count': V; 'count': V;
}; };