Skip to content

Commit 28b68b1

Browse files
committed
UI Mirroring Demo: ported to Godot 4.2
1 parent 0dfb54f commit 28b68b1

15 files changed

+224
-270
lines changed

gui/translation/project.godot

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ config_version=5
1313
config/name="Translation Demo"
1414
config/description="A demo showing how Godot seamlessly enables
1515
the use of localized resources and texts."
16+
config/tags=PackedStringArray("demo", "internationalization", "official")
1617
run/main_scene="res://translation_demo.tscn"
18+
config/features=PackedStringArray("4.2")
1719
config/icon="res://icon.webp"
18-
config/features=PackedStringArray("4.0")
19-
config/tags=PackedStringArray("demo", "internationalization", "official")
2020

2121
[display]
2222

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

2626
[internationalization]
2727

28-
locale/translations=PackedStringArray("res://text.en.translation", "res://text.es.translation", "res://text.ja.translation")
2928
locale/translation_remaps={
3029
"res://flag_uk.png": PackedStringArray("res://flag_spain.png:es", "res://flag_japan.png:ja"),
3130
"res://hello_en.wav": PackedStringArray("res://hello_es.wav:es", "res://hello_jp.wav:ja")
3231
}
32+
locale/translations=PackedStringArray("res://text.en.translation", "res://text.es.translation", "res://text.ja.translation")
3333
locale/locale_filter_mode=0
3434

3535
[locale]

gui/translation/translation_demo.tscn

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
[gd_scene load_steps=6 format=3 uid="uid://7bhrbgdbrped"]
1+
[gd_scene load_steps=5 format=3 uid="uid://7bhrbgdbrped"]
22

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

98
[node name="TranslationDemo" type="Control"]
9+
layout_mode = 3
10+
anchors_preset = 8
1011
anchor_left = 0.5
1112
anchor_top = 0.5
1213
anchor_right = 0.5
@@ -17,9 +18,10 @@ offset_right = 512.0
1718
offset_bottom = 300.0
1819
size_flags_horizontal = 2
1920
size_flags_vertical = 2
20-
script = ExtResource( "1" )
21+
script = ExtResource("1")
2122

2223
[node name="English" type="Button" parent="."]
24+
layout_mode = 0
2325
offset_left = 32.0
2426
offset_top = 64.0
2527
offset_right = 192.0
@@ -29,6 +31,7 @@ size_flags_vertical = 2
2931
text = "Use English"
3032

3133
[node name="Spanish" type="Button" parent="."]
34+
layout_mode = 0
3235
offset_left = 32.0
3336
offset_top = 112.0
3437
offset_right = 192.0
@@ -38,6 +41,7 @@ size_flags_vertical = 2
3841
text = "Use Spanish"
3942

4043
[node name="Japanese" type="Button" parent="."]
44+
layout_mode = 0
4145
offset_left = 32.0
4246
offset_top = 160.0
4347
offset_right = 192.0
@@ -47,6 +51,7 @@ size_flags_vertical = 2
4751
text = "Use Japanese"
4852

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

6671
[node name="HSeparator" type="HSeparator" parent="."]
72+
layout_mode = 0
6773
offset_left = 33.0
6874
offset_top = 330.0
6975
offset_right = 1001.0
7076
offset_bottom = 370.0
7177

7278
[node name="HelloText" type="Label" parent="."]
79+
layout_mode = 0
7380
offset_left = 246.0
7481
offset_top = 381.0
7582
offset_right = 324.0
7683
offset_bottom = 400.0
7784
size_flags_vertical = 0
78-
theme_override_fonts/font = ExtResource( "2_fnagj" )
7985
text = "KEY_HELLO"
8086

8187
[node name="PlayAudio" type="Button" parent="."]
88+
layout_mode = 0
8289
offset_left = 243.0
8390
offset_top = 442.0
8491
offset_right = 475.0
8592
offset_bottom = 467.0
86-
theme_override_fonts/font = ExtResource( "2_fnagj" )
8793
text = "KEY_PUSH"
88-
icon = ExtResource( "3" )
94+
icon = ExtResource("3")
8995

9096
[node name="Flag" type="TextureRect" parent="."]
97+
layout_mode = 0
9198
offset_left = 85.0
9299
offset_top = 382.0
93100
offset_right = 213.0
94101
offset_bottom = 467.0
95-
texture = ExtResource( "4" )
102+
texture = ExtResource("4")
96103

97104
[node name="Audio" type="AudioStreamPlayer" parent="."]
98-
stream = ExtResource( "5" )
105+
stream = ExtResource("5")
99106

100107
[node name="TextLabel" type="Label" parent="."]
108+
layout_mode = 0
101109
anchor_left = 0.5
102110
anchor_top = 0.5
103111
anchor_right = 0.5
@@ -108,13 +116,8 @@ offset_right = 487.0
108116
offset_bottom = 255.0
109117
grow_horizontal = 2
110118
grow_vertical = 2
111-
theme_override_fonts/font = ExtResource( "2_fnagj" )
112119
text = "This text is being translated through script:
113120
"
114-
__meta__ = {
115-
"_edit_layout_mode": 1,
116-
"_edit_use_custom_anchors": false
117-
}
118121

119122
[connection signal="pressed" from="English" to="." method="_on_english_pressed"]
120123
[connection signal="pressed" from="Spanish" to="." method="_on_spanish_pressed"]
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[remap]
22

33
importer="font_data_dynamic"
4-
type="FontData"
5-
uid="uid://cppw66bb3hcnx"
4+
type="FontFile"
5+
uid="uid://yxqbej5m8dyf"
66
path="res://.godot/imported/NotoNaskhArabic-Bold.ttf-b67ac52f5189efb58090e60209f82666.fontdata"
77

88
[deps]
@@ -12,17 +12,22 @@ dest_files=["res://.godot/imported/NotoNaskhArabic-Bold.ttf-b67ac52f5189efb58090
1212

1313
[params]
1414

15-
antialiased=true
15+
Rendering=null
16+
antialiasing=1
17+
generate_mipmaps=false
1618
multichannel_signed_distance_field=false
17-
msdf_pixel_range=8.0
19+
msdf_pixel_range=8
20+
msdf_size=48
21+
allow_system_fallback=true
1822
force_autohinter=false
1923
hinting=1
24+
subpixel_positioning=1
2025
oversampling=0.0
26+
Fallbacks=null
27+
fallbacks=[]
28+
Compress=null
2129
compress=true
22-
preload/char_ranges=PackedStringArray()
23-
preload/glyph_ranges=PackedStringArray()
24-
preload/configurations=PackedStringArray()
25-
support_overrides/language_enabled=PackedStringArray()
26-
support_overrides/language_disabled=PackedStringArray()
27-
support_overrides/script_enabled=PackedStringArray()
28-
support_overrides/script_disabled=PackedStringArray()
30+
preload=[]
31+
language_support={}
32+
script_support={}
33+
opentype_features={}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[remap]
22

33
importer="font_data_dynamic"
4-
type="FontData"
5-
uid="uid://gfhw2u2k16h"
4+
type="FontFile"
5+
uid="uid://dfamk7vwd87dx"
66
path="res://.godot/imported/NotoSans-Bold.ttf-8ff3d9f1cfda88e84d6afd9724b2bba7.fontdata"
77

88
[deps]
@@ -12,17 +12,22 @@ dest_files=["res://.godot/imported/NotoSans-Bold.ttf-8ff3d9f1cfda88e84d6afd9724b
1212

1313
[params]
1414

15-
antialiased=true
15+
Rendering=null
16+
antialiasing=1
17+
generate_mipmaps=false
1618
multichannel_signed_distance_field=false
17-
msdf_pixel_range=8.0
19+
msdf_pixel_range=8
20+
msdf_size=48
21+
allow_system_fallback=true
1822
force_autohinter=false
1923
hinting=1
24+
subpixel_positioning=1
2025
oversampling=0.0
26+
Fallbacks=null
27+
fallbacks=[]
28+
Compress=null
2129
compress=true
22-
preload/char_ranges=PackedStringArray()
23-
preload/glyph_ranges=PackedStringArray()
24-
preload/configurations=PackedStringArray()
25-
support_overrides/language_enabled=PackedStringArray()
26-
support_overrides/language_disabled=PackedStringArray()
27-
support_overrides/script_enabled=PackedStringArray()
28-
support_overrides/script_disabled=PackedStringArray()
30+
preload=[]
31+
language_support={}
32+
script_support={}
33+
opentype_features={}

gui/ui_mirroring/fonts/noto_font.res

192 KB
Binary file not shown.
92.7 KB
Binary file not shown.

gui/ui_mirroring/noto_font.tres

-8
This file was deleted.

gui/ui_mirroring/project.godot

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@
66
; [section] ; section goes between []
77
; param=value ; assign values to parameters
88

9-
config_version=4
9+
config_version=5
1010

1111
[application]
1212

1313
config/name="UI Mirroring Demo"
14+
config/tags=PackedStringArray("demo", "gui", "internationalization", "official")
1415
run/main_scene="res://ui_mirroring.tscn"
16+
config/features=PackedStringArray("4.2")
1517
config/icon="res://icon.webp"
16-
config/tags=PackedStringArray("demo", "gui", "internationalization", "official")
18+
19+
[internationalization]
20+
21+
locale/translations=PackedStringArray("res://translation.en.translation", "res://translation.ar.translation", "res://translation.es.translation", "res://translation.ja.translation")
-21.7 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
[remap]
22

33
importer="texture"
4-
type="StreamTexture2D"
4+
type="CompressedTexture2D"
55
uid="uid://bk7vjwlmxebjj"
6-
path="res://.godot/imported/ui_mirroring_ar.png-0ac3776471fa54847d7107e345a38530.stex"
6+
path="res://.godot/imported/ui_mirroring_ar.png-0ac3776471fa54847d7107e345a38530.ctex"
77
metadata={
88
"vram_texture": false
99
}
1010

1111
[deps]
1212

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

1616
[params]
1717

1818
compress/mode=0
19+
compress/high_quality=false
1920
compress/lossy_quality=0.7
2021
compress/hdr_compression=1
21-
compress/bptc_ldr=0
2222
compress/normal_map=0
2323
compress/channel_pack=0
24-
compress/streamed=false
2524
mipmaps/generate=false
2625
mipmaps/limit=-1
2726
roughness/mode=0
2827
roughness/src_normal=""
2928
process/fix_alpha_border=true
3029
process/premult_alpha=false
3130
process/normal_map_invert_y=false
32-
process/HDR_as_SRGB=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
3333
process/size_limit=0
3434
detect_3d/compress_to=1
35-
svg/scale=1.0
-22.5 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
11
[remap]
22

33
importer="texture"
4-
type="StreamTexture2D"
4+
type="CompressedTexture2D"
55
uid="uid://kmiwt21qccaq"
6-
path="res://.godot/imported/ui_mirroring_en.png-2424f2dd8e09af8f321757ff70ce6185.stex"
6+
path="res://.godot/imported/ui_mirroring_en.png-2424f2dd8e09af8f321757ff70ce6185.ctex"
77
metadata={
88
"vram_texture": false
99
}
1010

1111
[deps]
1212

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

1616
[params]
1717

1818
compress/mode=0
19+
compress/high_quality=false
1920
compress/lossy_quality=0.7
2021
compress/hdr_compression=1
21-
compress/bptc_ldr=0
2222
compress/normal_map=0
2323
compress/channel_pack=0
24-
compress/streamed=false
2524
mipmaps/generate=false
2625
mipmaps/limit=-1
2726
roughness/mode=0
2827
roughness/src_normal=""
2928
process/fix_alpha_border=true
3029
process/premult_alpha=false
3130
process/normal_map_invert_y=false
32-
process/HDR_as_SRGB=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
3333
process/size_limit=0
3434
detect_3d/compress_to=1
35-
svg/scale=1.0

gui/ui_mirroring/translation.csv

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
KEYS,en,ar,es,ja
2+
KEY_HELLO,Hello!,مرحبًا!,Hola!,こんにちは
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[remap]
2+
3+
importer="csv_translation"
4+
type="Translation"
5+
uid="uid://c1b0wcdgre0b4"
6+
7+
[deps]
8+
9+
files=["res://translation.en.translation", "res://translation.ar.translation", "res://translation.es.translation", "res://translation.ja.translation"]
10+
11+
source_file="res://translation.csv"
12+
dest_files=["res://translation.en.translation", "res://translation.ar.translation", "res://translation.es.translation", "res://translation.ja.translation"]
13+
14+
[params]
15+
16+
compress=true
17+
delimiter=0

0 commit comments

Comments
 (0)