Hi, I'm Hideki.
This article is originally posted here.
I use Godot when developing my games in most cases.
By the way, I am Japanese.
So I make my game in Japanese first. But I want people all over the world to play my game so I need to make it internationalized.
Godot is great. We can do it easily😍
As written in this document, We need to make
.csv files that describes the translation of each words.
keys, en, ja INFO,About this game,このゲームについて SAVED,"Saved successfully.","保存しました。" RESET,"Reset successfully.","リセットしました。"
keys(here INFO, SAVED, RESET) will be used in your code in gdscript later.
Separate each word with a comma(,) for each language.
Now, put this .csv file into the root of your Godot project.
Click this .csv file and click the
Project Settings and then click
You can add the translation file(ex:
text.en.translation) by pressing the
When you created
.csv file, you specified some keys(In my situation, INFO, SAVED, etc...). The opportunity to use it has come.
$Label.text = "SAVED"
If you write like the above, the string "SAVED" is converted to "保存しました。" in the devices supported Japanese, or "Saved successfully." in the other devices.
If you want to check if localization works properly, you can check it by the following:
func _ready(): TranslationServer.set_locale("en")
*"en" is the language you want to check.
Please refer to the Locale list to check the language code you want.