Skip to content

Commit 0ec3299

Browse files
committed
Add guide for adding new translations
1 parent 5608b78 commit 0ec3299

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

docs/Translating.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
This guide details how to translate the World-Altering Editor to new languages, using Chinese as an example.
2+
3+
## 1) Create translation folder
4+
5+
Check out the `/Config/Translations` folder. The one visible in your screenshot.
6+
7+
There, make a copy of the `en` folder. Name the new folder with the country code of your desired language, for example `cn` for Chinese.
8+
9+
Inside your new folder, rename `Translation_en.ini` to match the folder name, for example `Translation_cn.ini`. Do the same for `ObjectNames_en.ini`.
10+
11+
## 2) Add translation definition
12+
13+
Open `/Config/Translations.ini`.
14+
15+
There, add your new language under the `[Translations]` section, like follows:
16+
17+
```ini
18+
[Translations]
19+
0=English
20+
1=Chinese
21+
```
22+
23+
Then, add a new INI section for your new language to the file. Again, using Chinese as an example
24+
25+
```ini
26+
[Chinese]
27+
UIName=简体中文
28+
Directory=cn
29+
```
30+
31+
If you did everything correctly, your new language should now be available in the main menu.
32+
33+
![Language selection](images/languageselection.png "Language selection")
34+
35+
Afterwards, you can simply open the string-table INI file in your translation's folder, in this example `Translation_cn.ini`, and get to translating the UI strings.
36+
37+
If you want to translate object names, you can define them in `ObjectNames_*.ini`, in this example `ObjectNames_cn.ini`.
38+
39+
This is all that is needed to get a basic translation working. The following sections are optional, and a more advanced topic.
40+
41+
## 3) (Optional) Editing UI for a language
42+
43+
Sometimes, a translation might require UI changes. For example, some UI elements might need to be wider to accommodate longer text strings.
44+
45+
Starting from version 1.7.10, WAE supports modifying UI through overriding INI files added into the translation's directory.
46+
47+
For example, when WAE reads `BasicSectionConfigWindow.ini` for the Edit -> Basic user interface, WAE reads it from the following paths inside (`Config`) folder:
48+
49+
1) `/UI/Windows/`
50+
2) `/Default/UI/Windows/` if not found in the first path.
51+
52+
When `BasicSectionConfigWindow.ini` has been found from one of those locations, WAE then checks whether the current language has an override for it. In this file's example, WAE would read `/Translations/cn/UI/Windows/BasicSectionConfigWindow.ini`. If found, this file is merged into the original file's contents, with the translation-specific file taking priority in case of conflicting files.
53+
54+
For example, if `/Default/UI/Windows/BasicSectionConfigWindow.ini` has the following code:
55+
56+
```ini
57+
[lblHeader]
58+
FontIndex=1
59+
$Text=translate(Basic Options)
60+
$X=horizontalCenterOnParent()
61+
$Y=EMPTY_SPACE_TOP
62+
```
63+
64+
And if, for some reason, we wanted to change the header's position in our translation to the left edge of the window, we could create the file `/Translations/cn/UI/Windows/BasicSectionConfigWindow.ini`, and inside add the following code:
65+
66+
```ini
67+
[lblHeader]
68+
$X=EMPTY_SPACE_SIDES
69+
```
70+
71+
![Moved header example](images/moved header.png "Moved header example")
72+
73+
Control positions can be changed, windows resized etc. using this method.
74+
75+
## 4) (Optional) Overriding textures
76+
77+
There should rarely, if ever, be a need for this, but if your language requires modifying UI textures, that is also possible.
78+
79+
Similarly to the UI INI files above, when WAE loads a texture, it first looks it up whether the active translation's directory contains that texture.
80+
81+
For example, when loading `Content/checkBoxChecked.png`, with our example Chinese as the active language, WAE checks whether `/Config/Translations/cn/checkBoxChecked.png` exists, and if so, that is loaded instead of the file in the `Config` folder.

docs/images/languageselection.png

5.94 KB
Loading

docs/images/movedheader.png

19 KB
Loading

0 commit comments

Comments
 (0)