Update API scheme to layer 195.

This commit is contained in:
John Preston
2024-11-21 22:42:58 +04:00
parent 42142d819a
commit 51ddfbc340
43 changed files with 358 additions and 154 deletions

View File

@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "lang/lang_tag.h"
#include "core/stars_amount.h"
#include "lang/lang_keys.h"
#include "ui/text/text.h"
#include "base/qt/qt_common_adapters.h"
@@ -945,6 +946,21 @@ QString FormatCountDecimal(int64 number) {
return QString("%L1").arg(number);
}
QString FormatExactCountDecimal(float64 number) {
return QString("%L1").arg(number);
}
ShortenedCount FormatStarsAmountToShort(StarsAmount amount) {
const auto attempt = FormatCountToShort(amount.whole());
return attempt.shortened ? attempt : ShortenedCount{
.string = FormatStarsAmountDecimal(amount),
};
}
QString FormatStarsAmountDecimal(StarsAmount amount) {
return FormatExactCountDecimal(amount.value());
}
PluralResult Plural(
ushort keyBase,
float64 value,

View File

@@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
class StarsAmount;
enum lngtag_count : int;
namespace Lang {
@@ -26,6 +28,9 @@ struct ShortenedCount {
};
[[nodiscard]] ShortenedCount FormatCountToShort(int64 number);
[[nodiscard]] QString FormatCountDecimal(int64 number);
[[nodiscard]] QString FormatExactCountDecimal(float64 number);
[[nodiscard]] ShortenedCount FormatStarsAmountToShort(StarsAmount amount);
[[nodiscard]] QString FormatStarsAmountDecimal(StarsAmount amount);
struct PluralResult {
int keyShift = 0;