mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-01 01:45:06 +00:00
Moved generation of short string for large numbers in one place.
- Added new plural tag "kPluralShortTag". - Added support of new plural tag to code generator. - Removed FormatViewsCount from history_message. - Removed FormatLargeNumber from history_media_poll. - Added FormatCountToShort to lang_tag.
This commit is contained in:
@@ -136,11 +136,12 @@ QString lang(LangKey key);\n\
|
||||
auto nonPluralTagFound = false;
|
||||
for (auto &tagData : entry.tags) {
|
||||
auto &tag = tagData.tag;
|
||||
auto isPluralTag = isPlural && (tag == kPluralTag);
|
||||
auto isPluralTag = isPlural && (tag == kPluralTag || tag == kPluralShortTag);
|
||||
genericParams.push_back("lngtag_" + tag + ", " + (isPluralTag ? "float64 " : "const ResultString &") + tag + "__val");
|
||||
params.push_back("lngtag_" + tag + ", " + (isPluralTag ? "float64 " : "const QString &") + tag + "__val");
|
||||
if (isPluralTag) {
|
||||
plural = "\tauto plural = Lang::Plural(" + key + ", " + kPluralTag + "__val);\n";
|
||||
const auto isShortTag = (tag == kPluralShortTag) ? ("true") : ("false");
|
||||
plural = "\tauto plural = Lang::Plural(" + key + ", " + tag + "__val, " + isShortTag + ");\n";
|
||||
applyTags.push_back("\tresult = Lang::ReplaceTag<ResultString>::Call(std::move(result), lt_" + tag + ", Lang::StartReplacements<ResultString>::Call(std::move(plural.replacement)));\n");
|
||||
} else {
|
||||
nonPluralTagFound = true;
|
||||
|
||||
Reference in New Issue
Block a user