hello there,
for my projects i do this, in global.gd (for example) or anywhere you prefer.
var g_langue = ""
func _ready()
g_langue = OS.get_locale().left(2)
func getLangue():
return g_langue
func setLangue(l):
g_langue = l
Then in any scene i have 2 buttons (1 for french and another for english)
func _input(event):
if get_node("buttonFr").is_pressed():
get_node("/root/global").setLangue("fr")
langues()
if get_node("buttonEn").is_pressed():
get_node("/root/global").setLangue("en")
langues()
func langues():
mylangue = get_node("/root/global").getLangue()
if mylangue == "fr":
get_node("buttonFr").set_self_opacity(1.0)
get_node("buttonEn").set_self_opacity(0.5)
get_node("yourNode").set_text("c'est en français")
else:
get_node("buttonEn").set_self_opacity(1.0)
get_node("buttonFr").set_self_opacity(0.5)
get_node("yourNode").set_text("this is english")
Then on a press of a button (or something else) you can change language.
VoilĂ .