Skip to content

Commit

Permalink
Improve writing of Translation chapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
CakeVR authored Dec 13, 2023
1 parent 9218547 commit 2d9ec48
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions documentation/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@

## 📜 Content

- [1. What is translation?](#1-what-is-translation)
- [2. How to translate timelines?](#2-how-to-translate-timelines)
- [1. What is a translation?](#1-what-is-translation)
- [2. How do I translate timelines?](#2-how-to-translate-timelines)
- [2.1 Setting up translation](#21-setting-up-translation)
- [2.2 Writing translations](#22-writing-translations)
- [2.3 The translation workflow](#23-the-translation-workflow)
- [2.4 Testing translation](#24-testing-translation)
- [3. Changing the language](#3-changing-the-language)

## 1. What is translation?
## 1. What is a translation?

Translation is a Godot and Dialogic 2 feature, allowing you to translate your game into multiple languages.

Sometimes, the word *localisation* is used as well.
Localisation provides very specific regional considerations for each consumer market.\
This includes not only translation of the game, but also changes to the game itself to reflect specific cultural differences.
This includes not only the translation of the game, but also changes to the game itself to reflect specific cultural differences.

While Dialogic supports translation of your timeline, it's better to focus on
While Dialogic supports the translation of your timeline, it's better to focus on
your game first and add translation later.\
However, keeping the translation and localisation in mind is a very good idea:
However, keeping translation and localisation in mind is an excellent idea:

- How will you handle variables?
- Do you need the glossary?
Expand All @@ -38,27 +38,27 @@ Godot itself supports `gettext` as well.

---

## 2. How to translate timelines?
## 2. How do I translate timelines?

In Dialogic, head to the Settings tab, a look under the Translation section. Tick the "Enable Translation" checkbox.
In Dialogic, head to the Settings tab, and take a look under the Translation section. Tick the "Enable Translation" checkbox.

![translation_settings](media/translation/translation_settings.png)

### 2.1 Setting up translation

Let's walk through the settings! You will have to pick a default locale.
This locale must be the language you write the timeline in.
Additionally, this locale will be used as fallback, if no translation exists for a given translatable event.
Additionally, this locale will be used as a fallback, if no translation exists for a given translatable event.
The "translation file mode" allows you to store all your timelines into one file (Per Project) or into multiple files (Per Timeline).

Setting up a translation folder is a good idea, it keeps your project clean and allows you to easily find your translation files.

### 2.2 Writing translations

First of all, you will need to have a timeline file. Dialogic will automatically find and generate CSV files for you after you hit the "Update CSV files" button.
First of all, you will need a timeline file. Dialogic will automatically find and generate CSV files for you after you hit the "Update CSV files" button.

The CSV format is very simple and has a great variety of support. You can open it with any spreadsheet software, like Excel or Google Sheets. Even VSCode offers extensions to edit the file.\
The gist of CSV files is that each line represents a row and each column is separated by a comma.
The CSV format is simple, and you can open it with any spreadsheet software, like Excel or Google Sheets. Even VSCode offers extensions to edit the file.\
The gist of CSV files is that each line represents a row, and each column is separated by a comma.

Once Dialogic has generated the CSV file, it may look like this:

Expand All @@ -67,7 +67,7 @@ keys,en
Text/1/text,Hello World!"
```

The `keys` are locales, the `en` is the locale code for English, if you chose a different default locale, the locale code will be different.
The `keys` are locales, the `en` is the locale code for English. If you choose a different default locale, the locale code will be different.

You can add a new language for your game by adding a new column. The following example added "ja" for Japanese to the first row and translated the text in the second row. Pay attention to the commas!

Expand All @@ -76,7 +76,7 @@ keys,en,ja
Text/1/text,Hello World!,こんにちは世界!
```

That's it! You can now hit "Collect translation" and Dialogic will generate a translation file for you.\
That's it! You can now hit "Collect translation," and Dialogic will generate a translation file for you.\
The translation file is a specific Godot file. Here is their official documentation: [Internationalising games](https://docs.godotengine.org/en/stable/tutorials/i18n/internationalizing_games.html)

```admonish
Expand All @@ -88,7 +88,7 @@ In CSV, you use commas to separate columns. However, if you want to use commas i
From now on, whenever you change the CSV file, you can hit "Collect translation" and Dialogic will update the translation files for you.\
Once you are done editing your timeline, you will have to hit "Update CSV files" to update the CSV file.

In order to verify whether your timeline has been properly inserted your text into the CSV, you can switch into the timeline Text editor. Obviously, you can check the CSV file too.
To verify whether your timeline has properly inserted your text into the CSV, you can switch to the timeline Text editor. Obviously, you can check the CSV file too.

```dtl
Character: Hello world! #id:14
Expand All @@ -98,7 +98,7 @@ Do you like Visual Novels? #id:15
That's the spirit! #id:18
```

The `#id` tags at the end of each Text Event are the translation IDs. They won't be visible during text display, however, you can be rest assured that Dialogic has inserted the text into a CSV file.
The `#id` tags at the end of each Text Event are the translation IDs. They won't be visible during text display; however, Dialogic has inserted the text into a CSV file.

## 2.4 Testing translation

Expand All @@ -112,9 +112,9 @@ This setting is editor-only and may not work in exported projects.

The translation process is handled by Godot!

In order to change the locale when your game is exported, use the Godot API method on the [TranslationServer](https://docs.godotengine.org/en/stable/classes/class_translationserver.html#translationserver) class:
To change the locale when your game is exported, use the Godot API method on the [TranslationServer](https://docs.godotengine.org/en/stable/classes/class_translationserver.html#translationserver) class:

```gdscript
# Japanese's language code is "ja"
TranslationServer.set_locale("ja")
```
```

0 comments on commit 2d9ec48

Please sign in to comment.