Translation issues

i am using godot 4.5.1 and the localisation translation is not working and just defaults to the finnish one (which is the last one in the localisation list)

func _on_apply_pressed() -> void:
	global.language = global.languages[$SettingsPopup/Languages.selected]
	$SettingsPopup/Apply.text = tr("b_apply", global.language)

this applies the settings but nothing happens and it frustrates me

any help would be useful!

Could be a few things:

  • Make sure your translation file is correctly imported in Project Settings → Localization → Translations
  • Make sure b_apply is a correct string on that translation sheet.
  • Make sure the new language you’re setting it to has that string in the translation sheet.
  • Make sure global.language is a correct locale string. eg: “en”, “fr”

I’m not sure how you’re using the tr(“string“, language_locale), I’ve never personally used it this way, you should probably use: TranslationServer.set_locale(global.language)to set the language of the whole game to use it, and you should be able to just set the string of your Apply button to b_apply (in-editor) and it will automatically translate it when you change the locale. Otherwise I would only use tr(“string”) when you need to do more complex stuff like bbcodes and concatenated strings that need different bits pieced together. tr() will use the language of whatever the locale is set to in the Translation Server.

it works! thanks!