diff --git a/about/introduction.rst b/about/introduction.rst index c3314f475bf..717bbf20f1e 100644 --- a/about/introduction.rst +++ b/about/introduction.rst @@ -5,11 +5,19 @@ Introduction ============ -:: +.. tabs:: + .. code-tab:: gdscript func _ready(): print("Hello world!") + .. code-tab:: csharp + + public override void _Ready() + { + GD.Print("Hello world!"); + } + Welcome to the official documentation of **Godot Engine**, the free and open source community-driven 2D and 3D game engine! Behind this mouthful, you will find a powerful yet user-friendly tool that you can use to develop any kind of game, diff --git a/tutorials/i18n/internationalizing_games.rst b/tutorials/i18n/internationalizing_games.rst index 18cc299cdc3..afffbd0a1e0 100644 --- a/tutorials/i18n/internationalizing_games.rst +++ b/tutorials/i18n/internationalizing_games.rst @@ -75,11 +75,17 @@ Translate** in the inspector. In code, the :ref:`Object.tr() ` function can be used. This will just look up the text in the translations and convert it if found: -:: +.. tabs:: + .. code-tab:: gdscript level.text = tr("LEVEL_5_NAME") status.text = tr("GAME_STATUS_%d" % status_index) + .. code-tab:: csharp + + level.Text = Tr("LEVEL_5_NAME"); + status.Text = Tr($"GAME_STATUS_{statusIndex}"); + .. note:: If no text is displayed after changing the language, try to use a different @@ -105,7 +111,8 @@ allows translations to sound more natural. Named placeholders with the ``String.format()`` function should be used whenever possible, as they also allow translators to choose the *order* in which placeholders appear: -:: +.. tabs:: + .. code-tab:: gdscript # The placeholder's locations can be changed, but not their order. # This will probably not suffice for some target languages. @@ -125,7 +132,8 @@ optionally specify a *translation context* to resolve this ambiguity and allow target languages to use different strings, even though the source string is identical: -:: +.. tabs:: + .. code-tab:: gdscript # "Close", as in an action (to close something). button.set_text(tr("Close", "Actions")) @@ -133,6 +141,14 @@ identical: # "Close", as in a distance (opposite of "far"). distance_label.set_text(tr("Close", "Distance")) + .. code-tab:: csharp + + // "Close", as in an action (to close something). + GetNode