Localize article editor placeholder strings.

This commit is contained in:
John Preston
2026-07-11 14:14:27 +04:00
parent 3615c421c1
commit ba5ce48eec
4 changed files with 26 additions and 17 deletions
+7
View File
@@ -7398,6 +7398,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_article_media_slideshow" = "Slideshow";
"lng_article_insert_details" = "Details";
"lng_article_insert_table" = "Table";
"lng_article_placeholder_text" = "Text";
"lng_article_placeholder_header" = "Header";
"lng_article_placeholder_caption" = "Caption";
"lng_article_placeholder_cell" = "Cell";
"lng_article_placeholder_quote" = "Enter quote";
"lng_article_placeholder_author" = "Add author";
"lng_article_placeholder_title" = "Title";
"lng_article_limit_length" = "The article is too long.";
"lng_article_limit_depth" = "The article is nested too deeply.";
"lng_article_limit_blocks" = "The article has too many blocks.";
@@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#include "iv/editor/iv_editor_state.h"
#include "iv/editor/iv_editor_text_entities.h"
#include "lang/lang_keys.h"
#include "ui/text/text_utilities.h"
#include "ui/widgets/fields/input_field.h"
@@ -1795,33 +1796,33 @@ QString State::activePlaceholderText() const {
case BlockKind::Paragraph:
case BlockKind::Footer:
case BlockKind::Code:
return u"Text"_q;
return tr::lng_article_placeholder_text(tr::now);
case BlockKind::Quote:
return u"Enter quote"_q;
return tr::lng_article_placeholder_quote(tr::now);
case BlockKind::Heading:
return Markdown::HeadingLevelLabel(owner->headingLevel);
case BlockKind::Details:
return u"Header"_q;
return tr::lng_article_placeholder_header(tr::now);
default:
return QString();
}
case LeafKind::BlockCaption:
switch (owner->kind) {
case BlockKind::Quote:
return u"Add author"_q;
return tr::lng_article_placeholder_author(tr::now);
case BlockKind::Photo:
case BlockKind::Video:
case BlockKind::Audio:
case BlockKind::Map:
case BlockKind::GroupedMedia:
return u"Caption"_q;
return tr::lng_article_placeholder_caption(tr::now);
default:
return QString();
}
case LeafKind::ListItemText:
return u"Text"_q;
return tr::lng_article_placeholder_text(tr::now);
case LeafKind::TableCellText:
return u"Cell"_q;
return tr::lng_article_placeholder_cell(tr::now);
case LeafKind::MathFormula:
return u"x^2 + y^2"_q;
}
@@ -662,22 +662,22 @@ void ApplyBlockCaptionEditSource(
int headingLevel) {
switch (leafKind) {
case PreparedEditLeafKind::BlockCaption:
return u"Caption"_q;
return tr::lng_article_placeholder_caption(tr::now);
case PreparedEditLeafKind::TableCellText:
return u"Cell"_q;
return tr::lng_article_placeholder_cell(tr::now);
case PreparedEditLeafKind::MathFormula:
return u"x^2 + y^2"_q;
case PreparedEditLeafKind::ListItemText:
return u"Text"_q;
return tr::lng_article_placeholder_text(tr::now);
case PreparedEditLeafKind::BlockText:
if (kind == PreparedBlockKind::Table) {
return u"Title"_q;
return tr::lng_article_placeholder_title(tr::now);
} else if (kind == PreparedBlockKind::Heading) {
return HeadingLevelLabel(headingLevel);
}
return (kind == PreparedBlockKind::Details)
? u"Header"_q
: u"Text"_q;
? tr::lng_article_placeholder_header(tr::now)
: tr::lng_article_placeholder_text(tr::now);
}
return QString();
}
@@ -687,7 +687,7 @@ void ApplyNativeIvEditPlaceholderText(PreparedBlock *block) {
return;
} else if (block->quoteAuthor
&& (block->editLeaf->kind == PreparedEditLeafKind::BlockCaption)) {
block->editPlaceholderText = u"Add author"_q;
block->editPlaceholderText = tr::lng_article_placeholder_author(tr::now);
return;
}
block->editPlaceholderText = NativeIvEditPlaceholderText(
@@ -700,8 +700,8 @@ void ApplyNativeIvQuoteEditPlaceholderText(
PreparedBlock *block,
bool quoteAuthor) {
block->editPlaceholderText = quoteAuthor
? u"Add author"_q
: u"Enter quote"_q;
? tr::lng_article_placeholder_author(tr::now)
: tr::lng_article_placeholder_quote(tr::now);
}
void RefreshPreparedNativeIvQuotePlaceholder(
@@ -13,6 +13,7 @@ struct GeoPointLocation;
#include "data/data_location.h"
#include "iv/markdown/iv_markdown_prepare_links.h"
#include "iv/markdown/iv_markdown_prepare_serialize.h"
#include "lang/lang_keys.h"
#include "ui/basic_click_handlers.h"
#include "history/history_location_manager.h"
@@ -353,7 +354,7 @@ void ApplyEmptyMediaCaptionPlaceholder(
if (!state->editMode || !block->text.text.isEmpty()) {
return;
}
block->editPlaceholderText = u"Caption"_q;
block->editPlaceholderText = tr::lng_article_placeholder_caption(tr::now);
}
} // namespace