Merge pull request #112092 from timothyqiu/ts-nums

Move localized number formatting methods to `TranslationServer`
This commit is contained in:
Thaddeus Crews 2025-11-10 17:47:09 -06:00
commit 8327dfa215
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
27 changed files with 348 additions and 394 deletions

View file

@ -32,6 +32,7 @@
#include "core/config/project_settings.h"
#include "core/input/input_map.h"
#include "core/string/translation_server.h"
#include "editor/docks/inspector_dock.h"
#include "editor/docks/scene_tree_dock.h"
#include "editor/editor_node.h"
@ -1749,7 +1750,9 @@ void EditorPropertyEasing::_draw_easing() {
} else {
decimals = 1;
}
f->draw_string(ci, Point2(10, 10 + f->get_ascent(font_size)), TS->format_number(rtos(exp).pad_decimals(decimals)), HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
const String &formatted = TranslationServer::get_singleton()->format_number(rtos(exp).pad_decimals(decimals), _get_locale());
f->draw_string(ci, Point2(10, 10 + f->get_ascent(font_size)), formatted, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size, font_color);
}
void EditorPropertyEasing::update_property() {
@ -1767,7 +1770,7 @@ void EditorPropertyEasing::_set_preset(int p_preset) {
void EditorPropertyEasing::_setup_spin() {
spin->setup_and_show();
spin->get_line_edit()->set_text(TS->format_number(rtos(get_edited_property_value())));
spin->get_line_edit()->set_text(TranslationServer::get_singleton()->format_number(rtos(get_edited_property_value()), _get_locale()));
spin->show();
}