mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 20:23:53 +00:00
Merge pull request #89815 from KoBeWi/translates_bananas
Improve some notification and translation docs
This commit is contained in:
commit
0e36df69f9
@ -1182,6 +1182,14 @@
|
||||
- One of the node's theme property overrides is changed.
|
||||
- The node enters the scene tree.
|
||||
[b]Note:[/b] As an optimization, this notification won't be sent from changes that occur while this node is outside of the scene tree. Instead, all of the theme item updates can be applied at once when the node enters the scene tree.
|
||||
[b]Note:[/b] This notification is received alongside [constant Node.NOTIFICATION_ENTER_TREE], so if you are instantiating a scene, the child nodes will not be initialized yet. You can use it to setup theming for this node, child nodes created from script, or if you want to access child nodes added in the editor, make sure the node is ready using [method Node.is_node_ready].
|
||||
[codeblock]
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_THEME_CHANGED:
|
||||
if not is_node_ready():
|
||||
await ready # Wait until ready signal.
|
||||
$Label.add_theme_color_override("font_color", Color.YELLOW)
|
||||
[/codeblock]
|
||||
</constant>
|
||||
<constant name="NOTIFICATION_SCROLL_BEGIN" value="47">
|
||||
Sent when this node is inside a [ScrollContainer] which has begun being scrolled when dragging the scrollable area [i]with a touch event[/i]. This notification is [i]not[/i] sent when scrolling by dragging the scrollbar, scrolling with the mouse wheel or scrolling with keyboard/gamepad events.
|
||||
|
@ -187,7 +187,7 @@
|
||||
<param index="0" name="message" type="String" />
|
||||
<param index="1" name="context" type="StringName" default="""" />
|
||||
<description>
|
||||
Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation.
|
||||
Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. Note that most [Control] nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
|
||||
This method works the same as [method Object.tr], with the addition of respecting the [member auto_translate_mode] state.
|
||||
If [method Object.can_translate_messages] is [code]false[/code], or no translation is available, this method returns the [param message] without changes. See [method Object.set_message_translation].
|
||||
For detailed examples, see [url=$DOCS_URL/tutorials/i18n/internationalizing_games.html]Internationalizing games[/url].
|
||||
@ -1201,7 +1201,15 @@
|
||||
Implemented only on iOS.
|
||||
</constant>
|
||||
<constant name="NOTIFICATION_TRANSLATION_CHANGED" value="2010">
|
||||
Notification received when translations may have changed. Can be triggered by the user changing the locale. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr].
|
||||
Notification received when translations may have changed. Can be triggered by the user changing the locale, changing [member auto_translate_mode] or when the node enters the scene tree. Can be used to respond to language changes, for example to change the UI strings on the fly. Useful when working with the built-in translation support, like [method Object.tr].
|
||||
[b]Note:[/b] This notification is received alongside [constant NOTIFICATION_ENTER_TREE], so if you are instantiating a scene, the child nodes will not be initialized yet. You can use it to setup translations for this node, child nodes created from script, or if you want to access child nodes added in the editor, make sure the node is ready using [method is_node_ready].
|
||||
[codeblock]
|
||||
func _notification(what):
|
||||
if what == NOTIFICATION_TRANSLATION_CHANGED:
|
||||
if not is_node_ready():
|
||||
await ready # Wait until ready signal.
|
||||
$Label.text = atr("%d Bananas") % banana_counter
|
||||
[/codeblock]
|
||||
</constant>
|
||||
<constant name="NOTIFICATION_WM_ABOUT" value="2011">
|
||||
Notification received from the OS when a request for "About" information is sent.
|
||||
|
@ -1024,7 +1024,7 @@
|
||||
<param index="0" name="message" type="StringName" />
|
||||
<param index="1" name="context" type="StringName" default="&""" />
|
||||
<description>
|
||||
Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation.
|
||||
Translates a [param message], using the translation catalogs configured in the Project Settings. Further [param context] can be specified to help with the translation. Note that most [Control] nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
|
||||
If [method can_translate_messages] is [code]false[/code], or no translation is available, this method returns the [param message] without changes. See [method set_message_translation].
|
||||
For detailed examples, see [url=$DOCS_URL/tutorials/i18n/internationalizing_games.html]Internationalizing games[/url].
|
||||
</description>
|
||||
|
Loading…
Reference in New Issue
Block a user