@@ -105,12 +105,12 @@ void ReplicationEditor::_pick_node_selected(NodePath p_path) {
105105
106106void ReplicationEditor::_pick_new_property () {
107107 if (current == nullptr ) {
108- EditorNode::get_singleton ()->show_warning (TTR (" Select a replicator node in order to pick a property to add to it." ));
108+ EditorNode::get_singleton ()->show_warning (TTRC (" Select a replicator node in order to pick a property to add to it." ));
109109 return ;
110110 }
111111 Node *root = current->get_node (current->get_root_path ());
112112 if (!root) {
113- EditorNode::get_singleton ()->show_warning (TTR (" Not possible to add a new property to synchronize without a root." ));
113+ EditorNode::get_singleton ()->show_warning (TTRC (" Not possible to add a new property to synchronize without a root." ));
114114 return ;
115115 }
116116 pick_node->popup_scenetree_dialog (nullptr , current);
@@ -122,7 +122,7 @@ void ReplicationEditor::_add_sync_property(String p_path) {
122122 config = current->get_replication_config ();
123123
124124 if (config.is_valid () && config->has_property (p_path)) {
125- EditorNode::get_singleton ()->show_warning (TTR (" Property is already being synchronized." ));
125+ EditorNode::get_singleton ()->show_warning (TTRC (" Property is already being synchronized." ));
126126 return ;
127127 }
128128
@@ -166,7 +166,7 @@ ReplicationEditor::ReplicationEditor() {
166166
167167 pick_node = memnew (SceneTreeDialog);
168168 add_child (pick_node);
169- pick_node->set_title (TTR (" Pick a node to synchronize:" ));
169+ pick_node->set_title (TTRC (" Pick a node to synchronize:" ));
170170 pick_node->connect (" selected" , callable_mp (this , &ReplicationEditor::_pick_node_selected));
171171 pick_node->get_filter_line_edit ()->connect (SceneStringName (text_changed), callable_mp (this , &ReplicationEditor::_pick_node_filter_text_changed));
172172
@@ -223,15 +223,14 @@ ReplicationEditor::ReplicationEditor() {
223223 HBoxContainer *hb = memnew (HBoxContainer);
224224 vb->add_child (hb);
225225
226- add_pick_button = memnew (Button);
226+ add_pick_button = memnew (Button ( TTRC ( " Add property to sync... " )) );
227227 add_pick_button->connect (SceneStringName (pressed), callable_mp (this , &ReplicationEditor::_pick_new_property));
228- add_pick_button->set_text (TTR (" Add property to sync..." ));
229228 hb->add_child (add_pick_button);
230229
231230 VSeparator *vs = memnew (VSeparator);
232231 vs->set_custom_minimum_size (Size2 (30 * EDSCALE, 0 ));
233232 hb->add_child (vs);
234- hb->add_child (memnew (Label (TTR (" Path:" ))));
233+ hb->add_child (memnew (Label (TTRC (" Path:" ))));
235234
236235 np_line_edit = memnew (LineEdit);
237236 np_line_edit->set_placeholder (" :property" );
@@ -240,9 +239,8 @@ ReplicationEditor::ReplicationEditor() {
240239 np_line_edit->connect (SceneStringName (text_submitted), callable_mp (this , &ReplicationEditor::_np_text_submitted));
241240 hb->add_child (np_line_edit);
242241
243- add_from_path_button = memnew (Button);
242+ add_from_path_button = memnew (Button ( TTRC ( " Add from path " )) );
244243 add_from_path_button->connect (SceneStringName (pressed), callable_mp (this , &ReplicationEditor::_add_pressed));
245- add_from_path_button->set_text (TTR (" Add from path" ));
246244 hb->add_child (add_from_path_button);
247245
248246 vs = memnew (VSeparator);
@@ -252,19 +250,19 @@ ReplicationEditor::ReplicationEditor() {
252250 pin = memnew (Button);
253251 pin->set_theme_type_variation (SceneStringName (FlatButton));
254252 pin->set_toggle_mode (true );
255- pin->set_tooltip_text (TTR (" Pin replication editor" ));
253+ pin->set_tooltip_text (TTRC (" Pin replication editor" ));
256254 hb->add_child (pin);
257255
258256 tree = memnew (Tree);
259257 tree->set_hide_root (true );
260258 tree->set_columns (4 );
261259 tree->set_column_titles_visible (true );
262- tree->set_column_title (0 , TTR (" Properties" ));
260+ tree->set_column_title (0 , TTRC (" Properties" ));
263261 tree->set_column_expand (0 , true );
264- tree->set_column_title (1 , TTR (" Spawn" ));
262+ tree->set_column_title (1 , TTRC (" Spawn" ));
265263 tree->set_column_expand (1 , false );
266264 tree->set_column_custom_minimum_width (1 , 100 );
267- tree->set_column_title (2 , TTR (" Replicate" ));
265+ tree->set_column_title (2 , TTRC (" Replicate" ));
268266 tree->set_column_custom_minimum_width (2 , 100 );
269267 tree->set_column_expand (2 , false );
270268 tree->set_column_expand (3 , false );
@@ -274,9 +272,8 @@ ReplicationEditor::ReplicationEditor() {
274272 tree->set_v_size_flags (SIZE_EXPAND_FILL);
275273 vb->add_child (tree);
276274
277- drop_label = memnew (Label);
275+ drop_label = memnew (Label ( TTRC ( " Add properties using the options above, or \n drag them from the inspector and drop them here. " )) );
278276 drop_label->set_focus_mode (FOCUS_ACCESSIBILITY);
279- drop_label->set_text (TTR (" Add properties using the options above, or\n drag them from the inspector and drop them here." ));
280277 drop_label->set_horizontal_alignment (HORIZONTAL_ALIGNMENT_CENTER);
281278 drop_label->set_vertical_alignment (VERTICAL_ALIGNMENT_CENTER);
282279 tree->add_child (drop_label);
@@ -313,12 +310,12 @@ bool ReplicationEditor::_can_drop_data_fw(const Point2 &p_point, const Variant &
313310
314311void ReplicationEditor::_drop_data_fw (const Point2 &p_point, const Variant &p_data, Control *p_from) {
315312 if (current == nullptr ) {
316- EditorNode::get_singleton ()->show_warning (TTR (" Select a replicator node in order to pick a property to add to it." ));
313+ EditorNode::get_singleton ()->show_warning (TTRC (" Select a replicator node in order to pick a property to add to it." ));
317314 return ;
318315 }
319316 Node *root = current->get_node (current->get_root_path ());
320317 if (!root) {
321- EditorNode::get_singleton ()->show_warning (TTR (" Not possible to add a new property to synchronize without a root." ));
318+ EditorNode::get_singleton ()->show_warning (TTRC (" Not possible to add a new property to synchronize without a root." ));
322319 return ;
323320 }
324321
@@ -345,8 +342,21 @@ void ReplicationEditor::_drop_data_fw(const Point2 &p_point, const Variant &p_da
345342 _add_sync_property (path);
346343}
347344
345+ void _set_replication_mode_options (TreeItem *p_item) {
346+ p_item->set_text (2 , TTR (" Never" , " Replication Mode" ) + " ," + TTR (" Always" , " Replication Mode" ) + " ," + TTR (" On Change" , " Replication Mode" ));
347+ }
348+
348349void ReplicationEditor::_notification (int p_what) {
349350 switch (p_what) {
351+ case NOTIFICATION_TRANSLATION_CHANGED: {
352+ TreeItem *root = tree->get_root ();
353+ if (root) {
354+ for (TreeItem *ti = root->get_first_child (); ti; ti = ti->get_next ()) {
355+ _set_replication_mode_options (ti);
356+ }
357+ }
358+ } break ;
359+
350360 case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
351361 if (!EditorThemeManager::is_generated_theme_outdated ()) {
352362 break ;
@@ -363,17 +373,17 @@ void ReplicationEditor::_notification(int p_what) {
363373
364374void ReplicationEditor::_add_pressed () {
365375 if (!current) {
366- EditorNode::get_singleton ()->show_warning (TTR (" Please select a MultiplayerSynchronizer first." ));
376+ EditorNode::get_singleton ()->show_warning (TTRC (" Please select a MultiplayerSynchronizer first." ));
367377 return ;
368378 }
369379 if (current->get_root_path ().is_empty ()) {
370- EditorNode::get_singleton ()->show_warning (TTR (" The MultiplayerSynchronizer needs a root path." ));
380+ EditorNode::get_singleton ()->show_warning (TTRC (" The MultiplayerSynchronizer needs a root path." ));
371381 return ;
372382 }
373383 String np_text = np_line_edit->get_text ();
374384
375385 if (np_text.is_empty ()) {
376- EditorNode::get_singleton ()->show_warning (TTR (" Property/path must not be empty." ));
386+ EditorNode::get_singleton ()->show_warning (TTRC (" Property/path must not be empty." ));
377387 return ;
378388 }
379389
@@ -420,7 +430,7 @@ void ReplicationEditor::_tree_item_edited() {
420430 int old_value = config->property_get_replication_mode (prop);
421431 // We have a hard limit of 64 watchable properties per synchronizer.
422432 if (value == SceneReplicationConfig::REPLICATION_MODE_ON_CHANGE && config->get_watch_properties ().size () >= 64 ) {
423- EditorNode::get_singleton ()->show_warning (TTR (" Each MultiplayerSynchronizer can have no more than 64 watched properties." ));
433+ EditorNode::get_singleton ()->show_warning (TTRC (" Each MultiplayerSynchronizer can have no more than 64 watched properties." ));
424434 ti->set_range (column, old_value);
425435 return ;
426436 }
@@ -552,6 +562,7 @@ void ReplicationEditor::_add_property(const NodePath &p_property, bool p_spawn,
552562 item->set_selectable (2 , false );
553563 item->set_selectable (3 , false );
554564 item->set_text (0 , prop);
565+ item->set_auto_translate_mode (0 , AUTO_TRANSLATE_MODE_DISABLED);
555566 item->set_metadata (0 , prop);
556567 Node *root_node = current && !current->get_root_path ().is_empty () ? current->get_node (current->get_root_path ()) : nullptr ;
557568 Ref<Texture2D> icon = _get_class_icon (root_node);
@@ -568,7 +579,7 @@ void ReplicationEditor::_add_property(const NodePath &p_property, bool p_spawn,
568579 Variant value = node->get (subpath, &valid);
569580 if (valid && !can_sync (value)) {
570581 item->set_icon (0 , get_theme_icon (SNAME (" StatusWarning" ), EditorStringName (EditorIcons)));
571- item->set_tooltip_text (0 , TTR (" Property of this type not supported." ));
582+ item->set_tooltip_text (0 , TTRC (" Property of this type not supported." ));
572583 } else {
573584 item->set_icon (0 , icon);
574585 }
@@ -583,7 +594,8 @@ void ReplicationEditor::_add_property(const NodePath &p_property, bool p_spawn,
583594 item->set_text_alignment (2 , HORIZONTAL_ALIGNMENT_CENTER);
584595 item->set_cell_mode (2 , TreeItem::CELL_MODE_RANGE);
585596 item->set_range_config (2 , 0 , 2 , 1 );
586- item->set_text (2 , TTR (" Never" , " Replication Mode" ) + " ," + TTR (" Always" , " Replication Mode" ) + " ," + TTR (" On Change" , " Replication Mode" ));
597+ item->set_auto_translate_mode (2 , AUTO_TRANSLATE_MODE_DISABLED);
598+ _set_replication_mode_options (item);
587599 item->set_range (2 , (int )p_mode);
588600 item->set_editable (2 , true );
589601}
0 commit comments