Merge pull request #110378 from timothyqiu/rtl-preview

Make text-related nodes translation domain aware
This commit is contained in:
Thaddeus Crews 2025-10-16 12:48:05 -05:00
commit 9e96c7d9b8
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
23 changed files with 132 additions and 101 deletions

View file

@ -3227,8 +3227,9 @@ void TextMesh::_create_mesh_array(Array &p_arr) const {
TS->shaped_text_clear(text_rid);
TS->shaped_text_set_direction(text_rid, text_direction);
String txt = (uppercase) ? TS->string_to_upper(xl_text, language) : xl_text;
TS->shaped_text_add_string(text_rid, txt, font->get_rids(), font_size, font->get_opentype_features(), language);
const String &lang = language.is_empty() ? _get_locale() : language;
String txt = (uppercase) ? TS->string_to_upper(xl_text, lang) : xl_text;
TS->shaped_text_add_string(text_rid, txt, font->get_rids(), font_size, font->get_opentype_features(), lang);
TypedArray<Vector3i> stt;
if (st_parser == TextServer::STRUCTURED_TEXT_CUSTOM) {
@ -3686,11 +3687,8 @@ void TextMesh::_bind_methods() {
void TextMesh::_notification(int p_what) {
switch (p_what) {
case MainLoop::NOTIFICATION_TRANSLATION_CHANGED: {
String new_text = tr(text);
if (new_text == xl_text) {
return; // Nothing new.
}
xl_text = new_text;
// Language update might change the appearance of some characters.
xl_text = tr(text);
dirty_text = true;
request_update();
} break;