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";
"SectionDescriptionStarsForForMessages" = "You will receive {percent}% of the selected fee (~{amount}) for each incoming message.";
"SubtitlePrivacyAddUsers" = "Add Users";
"SubtitlePrivacyUsersCount" = "{count} users";
"PrivacyPaidMessagesValue" = "Paid";
"FirstMessageInPaidMessagesChat" = "**{user}** charges {amount} for each message.";
"ButtonBuyStars" = "Buy Stars";
"ComposerPlaceholderPaidMessage" = "Message for {amount}";
"ComposerPlaceholderPaidReply" = "Reply for {amount}";
"TitleConfirmPayment" = "Confirm Payment";
"ConfirmationModalPaymentForOneMessage" = "{user} charges **{amount} Stars** per incoming message. Would you like to pay **{amount} Stars** to send one message?";
"ConfirmationModalPaymentForMessages" = "{user} charges **{price} Stars** per incoming message. Would you like to pay **{amount} Stars** to send **{count} messages?**";
"ButtonPayForMessage" = "Pay for {count} message";
"ToastTitleMessageSent" = "Message sent!";
"ToastTitleMessagesSent" = "{count} Messages sent!";
"ToastMessageSent" = "You paid {amount} stars.";
"ConfirmationModalPaymentForMessage_one" = "{user} charges **{amount}** per incoming message. Would you like to pay **{totalAmount}** to send one message?";
"ConfirmationModalPaymentForMessage_other" = "{user} charges **{amount}** per incoming message. Would you like to pay **{totalAmount}** to send **{count} messages?**";
"PayForMessage_one" = "Pay for {count} message";
"PayForMessage_other" = "Pay for {count} messages";
"MessageSentPaidToastTitle_one" = "Message sent!";
"MessageSentPaidToastTitle_other" = "{count} messages sent!";
"MessageSentPaidToastText" = "You paid {amount}";
"ButtonUndo" = "Undo";
"ActionPaidOneMessageOutgoing" = "You paid {amount} Stars to send a message";
"ActionPaidOneMessageIncoming" = "You received {amount} Stars from {user}";
"ActionPaidOneMessageOutgoing" = "You paid {amount} to send a message";
"ActionPaidOneMessageIncoming" = "You received {amount} from {user}";
"PaneMessagePaidMessageCharge" = "{peer} must pay {amount} for each message to you.";
"ConfirmRemoveMessageFee" = "Yes";
"ConfirmDialogMessageRemoveFee" = "Are you sure you want to allow **{peer}** to message you for free?";
"ConfirmDialogRemoveFeeRefundStars" = "Refund already paid **{amount} Stars**";
"DescriptionGiftPaidMessage" = "{user} charges **{amount}** Stars for each message. That price has been added to the cost of the gift.";
"ConfirmDialogRemoveFeeRefundStars" = "Refund already paid **{amount}**";
"StoryTooltipGifSent" = "Gif Sent!";
"StoryTooltipStickerSent" = "Sticker Sent!";
"StoryTooltipReactionSent" = "Reaction Sent!";
@ -1897,4 +1896,4 @@
"PaidMessageTransactionTotal" = "Total";
"DescriptionRestrictedMedia" = "Posting media content is not allowed in this group.";
"DescriptionScheduledPaidMediaNotAllowed" = "Posting scheduled paid media content is not allowed";
"DescriptionScheduledPaidMessagesNotAllowed" = "Scheduled paid messages is not allowed";
"DescriptionScheduledPaidMessagesNotAllowed" = "Scheduled paid messages is not allowed";

View File

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

View File

@ -23,6 +23,7 @@ import { selectSender } from '../../global/selectors';
import buildClassName from '../../util/buildClassName';
import { formatHumanDate } from '../../util/dates/dateFormat';
import { compact } from '../../util/iteratees';
import { formatStarsAsText } from '../../util/localization/format';
import { isAlbum } from './helpers/groupMessages';
import { preventMessageInputBlur } from './helpers/preventMessageInputBlur';
@ -154,14 +155,14 @@ const MessageListContent: FC<OwnProps> = ({
<span>{
message.isOutgoing
? lang('ActionPaidOneMessageOutgoing', {
amount,
amount: formatStarsAsText(lang, amount),
})
: (() => {
const sender = selectSender(getGlobal(), message);
const userTitle = sender ? getPeerTitle(lang, sender) : '';
return lang('ActionPaidOneMessageIncoming', {
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 { selectUser } from '../../../../global/selectors';
import { formatStarsAsText } from '../../../../util/localization/format';
import useCurrentOrPrev from '../../../../hooks/useCurrentOrPrev';
import useLang from '../../../../hooks/useLang';
@ -61,7 +62,7 @@ const ChatRefundModal = ({ modal, user }: OwnProps & StateProps) => {
<Checkbox
className="dialog-checkbox"
label={lang('ConfirmDialogRemoveFeeRefundStars', {
amount: starsToRefund,
amount: formatStarsAsText(lang, starsToRefund),
}, {
withMarkdown: 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 { copyTextToClipboard } from '../../../util/clipboard';
import { getCurrentTabId } from '../../../util/establishMultitabRole';
import { getTranslationFn } from '../../../util/localization';
import { formatStarsAsText } from '../../../util/localization/format';
import { oldTranslate } from '../../../util/oldLangProvider';
import PopupManager from '../../../util/PopupManager';
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
actions.showNotification({
localId: queryId,
title: { key: 'ToastTitleMessageSent' },
message: { key: 'ToastMessageSent', variables: { amount: starsForOneMessage } },
title: { key: 'MessageSentPaidToastTitle', variables: { count: 1 }, options: { pluralValue: 1 } },
message: {
key: 'MessageSentPaidToastText', variables: { amount: formatStarsAsText(getTranslationFn(), starsForOneMessage) },
},
actionText: { key: 'ButtonUndo' },
dismissAction: {
action: 'sendInlineBotApiResult',

View File

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

View File

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