DEV Community

hideckies
hideckies

Posted on

How to Internationalize Your Game in Godot

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😍

1. Make CSV files

As written in this document, We need to make .csv files that describes the translation of each words.

For example:

keys, en, ja
INFO,About this game,このゲームについて
SAVED,"Saved successfully.","保存しました。"
RESET,"Reset successfully.","リセットしました。"
Enter fullscreen mode Exit fullscreen mode

keys(here INFO, SAVED, RESET) will be used in your code in gdscript later.
Separate each word with a comma(,) for each language.

2. Import .csv file

Now, put this .csv file into the root of your Godot project.

For example:

Alt Text

Click this .csv file and click the Import tab.

Alt Text

Click "Reimport".

3. Configure the translations.

Go to Project -> Project Settings and then click Localization tab.

Alt Text

You can add the translation file(ex: text.en.translation) by pressing the Add... button.

4. Convert key to text

When you created .csv file, you specified some keys(In my situation, INFO, SAVED, etc...). The opportunity to use it has come.

For instance:

$Label.text = "SAVED"
Enter fullscreen mode Exit fullscreen mode

If you write like the above, the string "SAVED" is converted to "保存しました。" in the devices supported Japanese, or "Saved successfully." in the other devices.

Well done!

5. Test

If you want to check if localization works properly, you can check it by the following:

func _ready():
    TranslationServer.set_locale("en")
Enter fullscreen mode Exit fullscreen mode

*"en" is the language you want to check.

Please refer to the Locale list to check the language code you want.

Now your game is International🌌

Top comments (0)