Skip to content

Commit

Permalink
UI Mirroring Demo: ported to Godot 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex2782 committed Oct 19, 2023
1 parent 0dfb54f commit 05e3444
Show file tree
Hide file tree
Showing 15 changed files with 161 additions and 305 deletions.
6 changes: 3 additions & 3 deletions gui/translation/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ config_version=5
config/name="Translation Demo"
config/description="A demo showing how Godot seamlessly enables
the use of localized resources and texts."
config/tags=PackedStringArray("demo", "internationalization", "official")
run/main_scene="res://translation_demo.tscn"
config/features=PackedStringArray("4.2")
config/icon="res://icon.webp"
config/features=PackedStringArray("4.0")
config/tags=PackedStringArray("demo", "internationalization", "official")

[display]

Expand All @@ -25,11 +25,11 @@ window/stretch/aspect="expand"

[internationalization]

locale/translations=PackedStringArray("res://text.en.translation", "res://text.es.translation", "res://text.ja.translation")
locale/translation_remaps={
"res://flag_uk.png": PackedStringArray("res://flag_spain.png:es", "res://flag_japan.png:ja"),
"res://hello_en.wav": PackedStringArray("res://hello_es.wav:es", "res://hello_jp.wav:ja")
}
locale/translations=PackedStringArray("res://text.en.translation", "res://text.es.translation", "res://text.ja.translation")
locale/locale_filter_mode=0

[locale]
Expand Down
29 changes: 16 additions & 13 deletions gui/translation/translation_demo.tscn
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[gd_scene load_steps=6 format=3 uid="uid://7bhrbgdbrped"]
[gd_scene load_steps=5 format=3 uid="uid://7bhrbgdbrped"]

[ext_resource type="Script" path="res://translation_demo.gd" id="1"]
[ext_resource type="Font" path="res://font/droid_sans.tres" id="2_fnagj"]
[ext_resource type="Texture2D" uid="uid://bbdxdamxifokx" path="res://speaker.png" id="3"]
[ext_resource type="Texture2D" uid="uid://cxbco5txqcf40" path="res://flag_uk.png" id="4"]
[ext_resource type="AudioStream" uid="uid://d3e12qtu6rlb6" path="res://hello_en.wav" id="5"]

[node name="TranslationDemo" type="Control"]
layout_mode = 3
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
Expand All @@ -17,9 +18,10 @@ offset_right = 512.0
offset_bottom = 300.0
size_flags_horizontal = 2
size_flags_vertical = 2
script = ExtResource( "1" )
script = ExtResource("1")

[node name="English" type="Button" parent="."]
layout_mode = 0
offset_left = 32.0
offset_top = 64.0
offset_right = 192.0
Expand All @@ -29,6 +31,7 @@ size_flags_vertical = 2
text = "Use English"

[node name="Spanish" type="Button" parent="."]
layout_mode = 0
offset_left = 32.0
offset_top = 112.0
offset_right = 192.0
Expand All @@ -38,6 +41,7 @@ size_flags_vertical = 2
text = "Use Spanish"

[node name="Japanese" type="Button" parent="."]
layout_mode = 0
offset_left = 32.0
offset_top = 160.0
offset_right = 192.0
Expand All @@ -47,6 +51,7 @@ size_flags_vertical = 2
text = "Use Japanese"

[node name="Description" type="Label" parent="."]
layout_mode = 0
offset_left = 243.0
offset_top = 42.0
offset_right = 804.0
Expand All @@ -64,40 +69,43 @@ modified. Resources can also be set internationalized alternatives and replaced
automatically on locale change."

[node name="HSeparator" type="HSeparator" parent="."]
layout_mode = 0
offset_left = 33.0
offset_top = 330.0
offset_right = 1001.0
offset_bottom = 370.0

[node name="HelloText" type="Label" parent="."]
layout_mode = 0
offset_left = 246.0
offset_top = 381.0
offset_right = 324.0
offset_bottom = 400.0
size_flags_vertical = 0
theme_override_fonts/font = ExtResource( "2_fnagj" )
text = "KEY_HELLO"

[node name="PlayAudio" type="Button" parent="."]
layout_mode = 0
offset_left = 243.0
offset_top = 442.0
offset_right = 475.0
offset_bottom = 467.0
theme_override_fonts/font = ExtResource( "2_fnagj" )
text = "KEY_PUSH"
icon = ExtResource( "3" )
icon = ExtResource("3")

[node name="Flag" type="TextureRect" parent="."]
layout_mode = 0
offset_left = 85.0
offset_top = 382.0
offset_right = 213.0
offset_bottom = 467.0
texture = ExtResource( "4" )
texture = ExtResource("4")

[node name="Audio" type="AudioStreamPlayer" parent="."]
stream = ExtResource( "5" )
stream = ExtResource("5")

[node name="TextLabel" type="Label" parent="."]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
Expand All @@ -108,13 +116,8 @@ offset_right = 487.0
offset_bottom = 255.0
grow_horizontal = 2
grow_vertical = 2
theme_override_fonts/font = ExtResource( "2_fnagj" )
text = "This text is being translated through script:
"
__meta__ = {
"_edit_layout_mode": 1,
"_edit_use_custom_anchors": false
}

[connection signal="pressed" from="English" to="." method="_on_english_pressed"]
[connection signal="pressed" from="Spanish" to="." method="_on_spanish_pressed"]
Expand Down
Binary file removed gui/ui_mirroring/fonts/NotoNaskhArabic-Bold.ttf
Binary file not shown.
28 changes: 0 additions & 28 deletions gui/ui_mirroring/fonts/NotoNaskhArabic-Bold.ttf.import

This file was deleted.

Binary file removed gui/ui_mirroring/fonts/NotoSans-Bold.ttf
Binary file not shown.
28 changes: 0 additions & 28 deletions gui/ui_mirroring/fonts/NotoSans-Bold.ttf.import

This file was deleted.

8 changes: 0 additions & 8 deletions gui/ui_mirroring/noto_font.tres

This file was deleted.

9 changes: 7 additions & 2 deletions gui/ui_mirroring/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
; [section] ; section goes between []
; param=value ; assign values to parameters

config_version=4
config_version=5

[application]

config/name="UI Mirroring Demo"
config/tags=PackedStringArray("demo", "gui", "internationalization", "official")
run/main_scene="res://ui_mirroring.tscn"
config/features=PackedStringArray("4.1")
config/icon="res://icon.webp"
config/tags=PackedStringArray("demo", "gui", "internationalization", "official")

[internationalization]

locale/translations=PackedStringArray("res://translation.en.translation", "res://translation.ar.translation", "res://translation.es.translation", "res://translation.ja.translation")
Binary file modified gui/ui_mirroring/screenshots/ui_mirroring_ar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions gui/ui_mirroring/screenshots/ui_mirroring_ar.png.import
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
[remap]

importer="texture"
type="StreamTexture2D"
type="CompressedTexture2D"
uid="uid://bk7vjwlmxebjj"
path="res://.godot/imported/ui_mirroring_ar.png-0ac3776471fa54847d7107e345a38530.stex"
path="res://.godot/imported/ui_mirroring_ar.png-0ac3776471fa54847d7107e345a38530.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://screenshots/ui_mirroring_ar.png"
dest_files=["res://.godot/imported/ui_mirroring_ar.png-0ac3776471fa54847d7107e345a38530.stex"]
dest_files=["res://.godot/imported/ui_mirroring_ar.png-0ac3776471fa54847d7107e345a38530.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
compress/streamed=false
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/HDR_as_SRGB=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
Binary file modified gui/ui_mirroring/screenshots/ui_mirroring_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions gui/ui_mirroring/screenshots/ui_mirroring_en.png.import
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
[remap]

importer="texture"
type="StreamTexture2D"
type="CompressedTexture2D"
uid="uid://kmiwt21qccaq"
path="res://.godot/imported/ui_mirroring_en.png-2424f2dd8e09af8f321757ff70ce6185.stex"
path="res://.godot/imported/ui_mirroring_en.png-2424f2dd8e09af8f321757ff70ce6185.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://screenshots/ui_mirroring_en.png"
dest_files=["res://.godot/imported/ui_mirroring_en.png-2424f2dd8e09af8f321757ff70ce6185.stex"]
dest_files=["res://.godot/imported/ui_mirroring_en.png-2424f2dd8e09af8f321757ff70ce6185.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
compress/streamed=false
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/HDR_as_SRGB=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
2 changes: 2 additions & 0 deletions gui/ui_mirroring/translation.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
KEYS,en,ar,es,ja
KEY_HELLO,Hello!,مرحبًا!,Hola!,こんにちは
17 changes: 17 additions & 0 deletions gui/ui_mirroring/translation.csv.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[remap]

importer="csv_translation"
type="Translation"
uid="uid://c1b0wcdgre0b4"

[deps]

files=["res://translation.en.translation", "res://translation.ar.translation", "res://translation.es.translation", "res://translation.ja.translation"]

source_file="res://translation.csv"
dest_files=["res://translation.en.translation", "res://translation.ar.translation", "res://translation.es.translation", "res://translation.ja.translation"]

[params]

compress=true
delimiter=0
Loading

0 comments on commit 05e3444

Please sign in to comment.