Can't change the translation

Godot Version

v4.3.stable.steam [77dcf97d8]

Question

first script (node #1):

extends Node
signal titlestart
signal titleend
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	titlestart.emit()
	TranslationServer.add_translation(load("res://localizations/engrish.translation"))
	TranslationServer.add_translation(load("res://localizations/yapanese.translation"))
	TranslationServer.add_translation(load("res://localizations/gibberish.translation"))


second script (Node #2):


func _on_button_pressed() -> void:
	TranslationServer.set_locale("en")


func _on_button_2_pressed() -> void:
	TranslationServer.set_locale("jp")

func _on_button_3_pressed() -> void:
	pass # Replace with function body.

how do I change language for my game?

  1. First, you need to check if your translations were loaded via the command, for example using:
    var all_local: Array = TranslationServer.get_loaded_locales(). This way you will be sure that these files were loaded correctly.
  2. These files should have a certain markup by language. That is, if there is en_En or just en. Inside Godot, as it turned out, the markup for Japanese is not jp, but ja_JP.
  3. If TranslationServer.get_loaded_locales() is empty, then I suggest creating a translation via global settings and the CSV file.