1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Make text-related nodes translation domain aware

- Makes `is_layout_rtl()` translation domain aware
- Makes various text-drawing controls translation domain aware
- Makes translation preview use the project's fallback locale when disabled
This commit is contained in:
Haoyu Qiu
2025-09-10 15:14:18 +08:00
parent 149a4b4ca1
commit 172c80df67
23 changed files with 132 additions and 101 deletions

View File

@@ -88,7 +88,7 @@ void SpinBox::_update_text(bool p_only_update_if_value_changed) {
double step = get_step();
String value = String::num(get_value(), Math::range_step_decimals(step));
if (is_localizing_numeral_system()) {
value = TS->format_number(value);
value = TS->format_number(value, _get_locale());
}
if (p_only_update_if_value_changed && value == last_text_value) {
@@ -137,8 +137,9 @@ void SpinBox::_text_submitted(const String &p_string) {
Ref<Expression> expr;
expr.instantiate();
const String &lang = _get_locale();
text = text.replace_char(';', ',');
text = TS->parse_number(text);
text = TS->parse_number(text, lang);
// Ignore the prefix and suffix in the expression.
text = text.trim_prefix(prefix + " ").trim_suffix(" " + suffix);
@@ -147,7 +148,7 @@ void SpinBox::_text_submitted(const String &p_string) {
if (err != OK) {
// If the expression failed try without converting commas to dots - they might have been for parameter separation.
text = p_string;
text = TS->parse_number(text);
text = TS->parse_number(text, lang);
text = text.trim_prefix(prefix + " ").trim_suffix(" " + suffix);
err = expr->parse(text);