Skip to content

Commit 4fec40e

Browse files
committed
use 4.4 TranslationDomain support
1 parent c041cc6 commit 4fec40e

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

addons/block_code/block_code_plugin.gd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ func _enter_tree():
4848
_translation_plugin = BlockTranslationParserPlugin.new()
4949
add_translation_parser_plugin(_translation_plugin)
5050

51+
if TranslationServer.has_method(&"get_or_add_domain"):
52+
var tool_locale := TranslationServer.get_tool_locale()
53+
var tx := TranslationServer.get_translation_object(tool_locale)
54+
var tx_domain := TranslationServer.get_or_add_domain(&"godot_block_coding")
55+
tx_domain.add_translation(tx)
56+
5157
# Remove unwanted class nodes from create node
5258
old_feature_profile = EditorInterface.get_current_feature_profile()
5359

@@ -96,6 +102,10 @@ func _exit_tree():
96102
print("Old feature profile was removed and cannot be reverted to. Reverting to default.")
97103
EditorInterface.set_current_feature_profile("")
98104

105+
if TranslationServer.has_method(&"get_or_add_domain"):
106+
var tx_domain := TranslationServer.get_or_add_domain(&"godot_block_coding")
107+
tx_domain.clear()
108+
99109

100110
func _ready():
101111
editor_inspector.connect("edited_object_changed", _on_editor_inspector_edited_object_changed)

addons/block_code/ui/blocks/block/block.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func _get_tooltip(at_position: Vector2) -> String:
217217
if not definition:
218218
return ""
219219

220-
var description_tx := TranslationServer.translate(definition.description)
220+
var description_tx := tr(definition.description)
221221
if definition.variant_type == Variant.Type.TYPE_NIL:
222222
return description_tx
223223

addons/block_code/ui/main_panel.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ var undo_redo: EditorUndoRedoManager:
4141

4242

4343
func _ready():
44+
if has_method(&"set_translation_domain"):
45+
set_translation_domain(&"godot_block_coding")
46+
4447
_context.changed.connect(_on_context_changed)
4548

4649
_picker.block_picked.connect(_drag_manager.copy_picked_block_and_drag)

0 commit comments

Comments
 (0)