Skip to content

Commit 8974a7c

Browse files
committed
Update GUI Translation demo for 4.0
- Add PO support in addition to CSV.
1 parent ea37c10 commit 8974a7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+991
-507
lines changed

gui/translation/README.md

+28-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,36 @@
11
# GUI Translation Demo
22

3-
A demo showing how Godot seamlessly enables
4-
the use of localized resources and texts.
3+
This is a demo of how a project can be internationalized. Translations are
4+
created in a CSV file and then imported into Godot.
55

6-
Language: GDScript
6+
For correct display, the font used must contain the glyphs required by the
7+
target language. See the `fonts` folder for some fonts that you can use in your
8+
project. Godot can load system fonts as a fallback, but this is not supported on
9+
all platforms and the different visual design of system fonts can create
10+
inconsistencies.
11+
12+
Godot allows internationalized text to change automatically when the locale is
13+
modified. Resources can also be set to internationalized alternatives and replaced
14+
automatically on locale change. This process is known as *remapping*.
15+
16+
Both CSV and gettext (PO/POT) approaches are showcased. Use the button in the
17+
bottom-right corner to switch between the two approaches.
18+
19+
The resouce remapping process with PO is the same with CSV. The in-game text translation
20+
process is also the same – use keys to fetch the appropriate translation.
721

8-
Renderer: Vulkan Mobile
22+
The main difference between PO files and CSV files is the way both of them store
23+
the translated data in their files. Have a look at the `translations/po`
24+
and `translations/csv` folders to see the files involved.
25+
26+
See [Internationalizing games](https://docs.godotengine.org/en/latest/tutorials/i18n/internationalizing_games.html)
27+
and [Localization using gettext](https://docs.godotengine.org/en/latest/tutorials/i18n/localization_using_gettext.html)
28+
for more information.
29+
30+
Language: GDScript
931

10-
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/134
32+
Renderer: Compatibility
1133

1234
## Screenshots
1335

14-
![Screenshot](screenshots/translation.png)
36+
![Screenshot](screenshots/translation.webp)
File renamed without changes.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[remap]
2+
3+
importer="wav"
4+
type="AudioStreamWAV"
5+
uid="uid://ciept8j0x21to"
6+
path="res://.godot/imported/hello_en.wav-2eea592f221b07e3c37c5477c1da8173.sample"
7+
8+
[deps]
9+
10+
source_file="res://audio/hello_en.wav"
11+
dest_files=["res://.godot/imported/hello_en.wav-2eea592f221b07e3c37c5477c1da8173.sample"]
12+
13+
[params]
14+
15+
force/8_bit=false
16+
force/mono=false
17+
force/max_rate=false
18+
force/max_rate_hz=44100
19+
edit/trim=false
20+
edit/normalize=false
21+
edit/loop_mode=0
22+
edit/loop_begin=0
23+
edit/loop_end=-1
24+
compress/mode=0
File renamed without changes.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[remap]
2+
3+
importer="wav"
4+
type="AudioStreamWAV"
5+
uid="uid://dd4xk00uh27hj"
6+
path="res://.godot/imported/hello_es.wav-0b3ee7fc19ef7ac4822f3f3dc177c570.sample"
7+
8+
[deps]
9+
10+
source_file="res://audio/hello_es.wav"
11+
dest_files=["res://.godot/imported/hello_es.wav-0b3ee7fc19ef7ac4822f3f3dc177c570.sample"]
12+
13+
[params]
14+
15+
force/8_bit=false
16+
force/mono=false
17+
force/max_rate=false
18+
force/max_rate_hz=44100
19+
edit/trim=false
20+
edit/normalize=false
21+
edit/loop_mode=0
22+
edit/loop_begin=0
23+
edit/loop_end=-1
24+
compress/mode=0
File renamed without changes.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[remap]
2+
3+
importer="wav"
4+
type="AudioStreamWAV"
5+
uid="uid://3tnymbrsqo0w"
6+
path="res://.godot/imported/hello_jp.wav-c7c916ef924fa85620d3858f227d094f.sample"
7+
8+
[deps]
9+
10+
source_file="res://audio/hello_jp.wav"
11+
dest_files=["res://.godot/imported/hello_jp.wav-c7c916ef924fa85620d3858f227d094f.sample"]
12+
13+
[params]
14+
15+
force/8_bit=false
16+
force/mono=false
17+
force/max_rate=false
18+
force/max_rate_hz=44100
19+
edit/trim=false
20+
edit/normalize=false
21+
edit/loop_mode=0
22+
edit/loop_begin=0
23+
edit/loop_end=-1
24+
compress/mode=0

gui/translation/audio/hello_ru.wav

94.7 KB
Binary file not shown.
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[remap]
2+
3+
importer="wav"
4+
type="AudioStreamWAV"
5+
uid="uid://dkuqg8u4fid5m"
6+
path="res://.godot/imported/hello_ru.wav-490e2b267af12af16807f2bf3de6d995.sample"
7+
8+
[deps]
9+
10+
source_file="res://audio/hello_ru.wav"
11+
dest_files=["res://.godot/imported/hello_ru.wav-490e2b267af12af16807f2bf3de6d995.sample"]
12+
13+
[params]
14+
15+
force/8_bit=false
16+
force/mono=false
17+
force/max_rate=false
18+
force/max_rate_hz=44100
19+
edit/trim=false
20+
edit/normalize=false
21+
edit/loop_mode=0
22+
edit/loop_begin=0
23+
edit/loop_end=-1
24+
compress/mode=0

gui/translation/flag_japan.png

-857 Bytes
Binary file not shown.

gui/translation/flag_spain.png

-2.56 KB
Binary file not shown.

gui/translation/flag_uk.png

-3.71 KB
Binary file not shown.

gui/translation/font/DroidSans.ttf.import

-33
This file was deleted.

gui/translation/font/DroidSansArabic.ttf.import

-33
This file was deleted.

gui/translation/font/DroidSansFallback.ttf.import

-33
This file was deleted.

gui/translation/font/DroidSansHebrew.ttf.import

-33
This file was deleted.

gui/translation/font/DroidSansJapanese.ttf.import

-33
This file was deleted.

gui/translation/font/DroidSansThai.ttf.import

-33
This file was deleted.

gui/translation/font/droid_sans.tres

-22
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)