-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update GUI Translation demo for 4.0 (#930)
- Add PO support in addition to CSV. Co-authored-by: SkyJJ <[email protected]>
- Loading branch information
1 parent
f70868c
commit 5bda007
Showing
59 changed files
with
812 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,36 @@ | ||
# GUI Translation Demo | ||
|
||
A demo showing how Godot seamlessly enables | ||
the use of localized resources and texts. | ||
This is a demo of how a project can be internationalized. Translations are | ||
created in a CSV file and then imported into Godot. | ||
|
||
For correct display, the font used must contain the glyphs required by the | ||
target language. See the `fonts` folder for some fonts that you can use in your | ||
project. Godot can load system fonts as a fallback, but this is not supported on | ||
all platforms and the different visual design of system fonts can create | ||
inconsistencies. | ||
|
||
Godot allows internationalized text to change automatically when the locale is | ||
modified. Resources can also be set to internationalized alternatives and replaced | ||
automatically on locale change. This process is known as *remapping*. | ||
|
||
Both CSV and gettext (PO/POT) approaches are showcased. Use the button in the | ||
bottom-right corner to switch between the two approaches. | ||
|
||
The resouce remapping process with PO is the same with CSV. The in-game text translation | ||
process is also the same – use keys to fetch the appropriate translation. | ||
|
||
The main difference between PO files and CSV files is the way both of them store | ||
the translated data in their files. Have a look at the `translations/po` | ||
and `translations/csv` folders to see the files involved. | ||
|
||
See [Internationalizing games](https://docs.godotengine.org/en/latest/tutorials/i18n/internationalizing_games.html) | ||
and [Localization using gettext](https://docs.godotengine.org/en/latest/tutorials/i18n/localization_using_gettext.html) | ||
for more information. | ||
|
||
Language: GDScript | ||
|
||
Renderer: Compatibility | ||
|
||
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/134 | ||
|
||
## Screenshots | ||
|
||
![Screenshot](screenshots/translation.png) | ||
![Screenshot](screenshots/translation.webp) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://ciept8j0x21to" | ||
path="res://.godot/imported/hello_en.wav-2eea592f221b07e3c37c5477c1da8173.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://audio/hello_en.wav" | ||
dest_files=["res://.godot/imported/hello_en.wav-2eea592f221b07e3c37c5477c1da8173.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=0 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://dd4xk00uh27hj" | ||
path="res://.godot/imported/hello_es.wav-0b3ee7fc19ef7ac4822f3f3dc177c570.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://audio/hello_es.wav" | ||
dest_files=["res://.godot/imported/hello_es.wav-0b3ee7fc19ef7ac4822f3f3dc177c570.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=0 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://3tnymbrsqo0w" | ||
path="res://.godot/imported/hello_jp.wav-c7c916ef924fa85620d3858f227d094f.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://audio/hello_jp.wav" | ||
dest_files=["res://.godot/imported/hello_jp.wav-c7c916ef924fa85620d3858f227d094f.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=0 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[remap] | ||
|
||
importer="wav" | ||
type="AudioStreamWAV" | ||
uid="uid://dkuqg8u4fid5m" | ||
path="res://.godot/imported/hello_ru.wav-490e2b267af12af16807f2bf3de6d995.sample" | ||
|
||
[deps] | ||
|
||
source_file="res://audio/hello_ru.wav" | ||
dest_files=["res://.godot/imported/hello_ru.wav-490e2b267af12af16807f2bf3de6d995.sample"] | ||
|
||
[params] | ||
|
||
force/8_bit=false | ||
force/mono=false | ||
force/max_rate=false | ||
force/max_rate_hz=44100 | ||
edit/trim=false | ||
edit/normalize=false | ||
edit/loop_mode=0 | ||
edit/loop_begin=0 | ||
edit/loop_end=-1 | ||
compress/mode=0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[gd_resource type="FontFile" load_steps=7 format=3 uid="uid://b0887xnwnkgju"] | ||
|
||
[ext_resource type="FontFile" uid="uid://b6jt1itr5jreh" path="res://fonts/DroidSansArabic.ttf" id="1"] | ||
[ext_resource type="FontFile" uid="uid://cdrxhlo8nqckh" path="res://fonts/DroidSansFallback.ttf" id="2"] | ||
[ext_resource type="FontFile" uid="uid://7bhkit5l8dka" path="res://fonts/DroidSansHebrew.ttf" id="3"] | ||
[ext_resource type="FontFile" uid="uid://b74c6j1be4nyv" path="res://fonts/DroidSansJapanese.ttf" id="4"] | ||
[ext_resource type="FontFile" uid="uid://t73gcvmo33on" path="res://fonts/DroidSansThai.ttf" id="5"] | ||
[ext_resource type="FontFile" uid="uid://qaejxgrojp2d" path="res://fonts/DroidSans.ttf" id="6"] | ||
|
||
[resource] | ||
fallbacks = Array[Font]([ExtResource("6"), ExtResource("1"), ExtResource("2"), ExtResource("3"), ExtResource("4"), ExtResource("5")]) | ||
face_index = null | ||
embolden = null | ||
transform = null | ||
cache/0/16/0/ascent = 0.0 | ||
cache/0/16/0/descent = 0.0 | ||
cache/0/16/0/underline_position = 0.0 | ||
cache/0/16/0/underline_thickness = 0.0 | ||
cache/0/16/0/scale = 1.0 | ||
cache/0/16/0/glyphs/0/advance = Vector2(0, 0) | ||
cache/0/16/0/glyphs/0/offset = Vector2(0, 0) | ||
cache/0/16/0/glyphs/0/size = Vector2(0, 0) | ||
cache/0/16/0/glyphs/0/uv_rect = Rect2(0, 0, 0, 0) | ||
cache/0/16/0/glyphs/0/texture_idx = -1 | ||
cache/0/16/0/kerning_overrides/16/0 = Vector2(0, 0) | ||
cache/0/16/0/kerning_overrides/50/0 = Vector2(0, 0) | ||
cache/0/50/0/ascent = 0.0 | ||
cache/0/50/0/descent = 0.0 | ||
cache/0/50/0/underline_position = 0.0 | ||
cache/0/50/0/underline_thickness = 0.0 | ||
cache/0/50/0/scale = 1.0 | ||
cache/0/50/0/kerning_overrides/16/0 = Vector2(0, 0) | ||
cache/0/50/0/kerning_overrides/50/0 = Vector2(0, 0) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.