瀏覽代碼

Merge pull request #704 from voylin/Fix_Translation_Demo_4.0-dev

Fixed Translation Demo not working in 4.0-dev
Aaron Franke 3 年之前
父節點
當前提交
188cfda940

+ 1 - 1
gui/translation/README.md

@@ -5,7 +5,7 @@ the use of localized resources and texts.
 
 Language: GDScript
 
-Renderer: GLES 2
+Renderer: Vulkan Mobile
 
 Check out this demo on the asset library: https://godotengine.org/asset-library/asset/134
 

+ 13 - 15
gui/translation/flag_japan.png.import

@@ -1,8 +1,9 @@
 [remap]
 
 importer="texture"
-type="StreamTexture2D"
-path="res://.godot/imported/flag_japan.png-e7284e6af3de26ab9c66cac9c4062038.stex"
+type="CompressedTexture2D"
+uid="uid://nokaqfa1grg5"
+path="res://.godot/imported/flag_japan.png-e7284e6af3de26ab9c66cac9c4062038.ctex"
 metadata={
 "vram_texture": false
 }
@@ -10,26 +11,23 @@ metadata={
 [deps]
 
 source_file="res://flag_japan.png"
-dest_files=["res://.godot/imported/flag_japan.png-e7284e6af3de26ab9c66cac9c4062038.stex"]
+dest_files=["res://.godot/imported/flag_japan.png-e7284e6af3de26ab9c66cac9c4062038.ctex"]
 
 [params]
 
 compress/mode=0
 compress/lossy_quality=0.7
-compress/hdr_mode=0
+compress/hdr_compression=1
 compress/bptc_ldr=0
 compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
 process/fix_alpha_border=true
 process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
 process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 13 - 15
gui/translation/flag_spain.png.import

@@ -1,8 +1,9 @@
 [remap]
 
 importer="texture"
-type="StreamTexture2D"
-path="res://.godot/imported/flag_spain.png-fd2012b4e19487cfc4923df0c268553f.stex"
+type="CompressedTexture2D"
+uid="uid://dsh7m5tl07jml"
+path="res://.godot/imported/flag_spain.png-fd2012b4e19487cfc4923df0c268553f.ctex"
 metadata={
 "vram_texture": false
 }
@@ -10,26 +11,23 @@ metadata={
 [deps]
 
 source_file="res://flag_spain.png"
-dest_files=["res://.godot/imported/flag_spain.png-fd2012b4e19487cfc4923df0c268553f.stex"]
+dest_files=["res://.godot/imported/flag_spain.png-fd2012b4e19487cfc4923df0c268553f.ctex"]
 
 [params]
 
 compress/mode=0
 compress/lossy_quality=0.7
-compress/hdr_mode=0
+compress/hdr_compression=1
 compress/bptc_ldr=0
 compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
 process/fix_alpha_border=true
 process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
 process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 13 - 15
gui/translation/flag_uk.png.import

@@ -1,8 +1,9 @@
 [remap]
 
 importer="texture"
-type="StreamTexture2D"
-path="res://.godot/imported/flag_uk.png-eb8a2b26ac36f4d0cf0d7345e577ec2c.stex"
+type="CompressedTexture2D"
+uid="uid://cxbco5txqcf40"
+path="res://.godot/imported/flag_uk.png-eb8a2b26ac36f4d0cf0d7345e577ec2c.ctex"
 metadata={
 "vram_texture": false
 }
@@ -10,26 +11,23 @@ metadata={
 [deps]
 
 source_file="res://flag_uk.png"
-dest_files=["res://.godot/imported/flag_uk.png-eb8a2b26ac36f4d0cf0d7345e577ec2c.stex"]
+dest_files=["res://.godot/imported/flag_uk.png-eb8a2b26ac36f4d0cf0d7345e577ec2c.ctex"]
 
 [params]
 
 compress/mode=0
 compress/lossy_quality=0.7
-compress/hdr_mode=0
+compress/hdr_compression=1
 compress/bptc_ldr=0
 compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
 process/fix_alpha_border=true
 process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
 process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 33 - 0
gui/translation/font/DroidSans.ttf.import

@@ -0,0 +1,33 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontData"
+uid="uid://33p1pmbcp0bh"
+path="res://.godot/imported/DroidSans.ttf-ba789e8a8b60473207799201d8a90bb4.fontdata"
+
+[deps]
+
+source_file="res://font/DroidSans.ttf"
+dest_files=["res://.godot/imported/DroidSans.ttf-ba789e8a8b60473207799201d8a90bb4.fontdata"]
+
+[params]
+
+antialiased=true
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+force_autohinter=false
+hinting=1
+subpixel_positioning=1
+embolden=0.0
+transform=Transform2D(1, 0, 0, 1, 0, 0)
+oversampling=0.0
+compress=true
+opentype_feature_overrides={}
+preload/char_ranges=PackedStringArray()
+preload/glyph_ranges=PackedStringArray()
+preload/configurations=PackedStringArray()
+support_overrides/language_enabled=PackedStringArray()
+support_overrides/language_disabled=PackedStringArray()
+support_overrides/script_enabled=PackedStringArray()
+support_overrides/script_disabled=PackedStringArray()

+ 33 - 0
gui/translation/font/DroidSansArabic.ttf.import

@@ -0,0 +1,33 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontData"
+uid="uid://c7ujio1oqntre"
+path="res://.godot/imported/DroidSansArabic.ttf-da8dabd885d494269ba77c8d78d8ed5b.fontdata"
+
+[deps]
+
+source_file="res://font/DroidSansArabic.ttf"
+dest_files=["res://.godot/imported/DroidSansArabic.ttf-da8dabd885d494269ba77c8d78d8ed5b.fontdata"]
+
+[params]
+
+antialiased=true
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+force_autohinter=false
+hinting=1
+subpixel_positioning=1
+embolden=0.0
+transform=Transform2D(1, 0, 0, 1, 0, 0)
+oversampling=0.0
+compress=true
+opentype_feature_overrides={}
+preload/char_ranges=PackedStringArray()
+preload/glyph_ranges=PackedStringArray()
+preload/configurations=PackedStringArray()
+support_overrides/language_enabled=PackedStringArray()
+support_overrides/language_disabled=PackedStringArray()
+support_overrides/script_enabled=PackedStringArray()
+support_overrides/script_disabled=PackedStringArray()

+ 33 - 0
gui/translation/font/DroidSansFallback.ttf.import

@@ -0,0 +1,33 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontData"
+uid="uid://xesv5idkrqcd"
+path="res://.godot/imported/DroidSansFallback.ttf-9bc560676e9de93a3474250e8f345fde.fontdata"
+
+[deps]
+
+source_file="res://font/DroidSansFallback.ttf"
+dest_files=["res://.godot/imported/DroidSansFallback.ttf-9bc560676e9de93a3474250e8f345fde.fontdata"]
+
+[params]
+
+antialiased=true
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+force_autohinter=false
+hinting=1
+subpixel_positioning=1
+embolden=0.0
+transform=Transform2D(1, 0, 0, 1, 0, 0)
+oversampling=0.0
+compress=true
+opentype_feature_overrides={}
+preload/char_ranges=PackedStringArray()
+preload/glyph_ranges=PackedStringArray()
+preload/configurations=PackedStringArray()
+support_overrides/language_enabled=PackedStringArray()
+support_overrides/language_disabled=PackedStringArray()
+support_overrides/script_enabled=PackedStringArray()
+support_overrides/script_disabled=PackedStringArray()

+ 33 - 0
gui/translation/font/DroidSansHebrew.ttf.import

@@ -0,0 +1,33 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontData"
+uid="uid://cft2167j0ba27"
+path="res://.godot/imported/DroidSansHebrew.ttf-2fc88dbe58ef638a09561323f2a293d1.fontdata"
+
+[deps]
+
+source_file="res://font/DroidSansHebrew.ttf"
+dest_files=["res://.godot/imported/DroidSansHebrew.ttf-2fc88dbe58ef638a09561323f2a293d1.fontdata"]
+
+[params]
+
+antialiased=true
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+force_autohinter=false
+hinting=1
+subpixel_positioning=1
+embolden=0.0
+transform=Transform2D(1, 0, 0, 1, 0, 0)
+oversampling=0.0
+compress=true
+opentype_feature_overrides={}
+preload/char_ranges=PackedStringArray()
+preload/glyph_ranges=PackedStringArray()
+preload/configurations=PackedStringArray()
+support_overrides/language_enabled=PackedStringArray()
+support_overrides/language_disabled=PackedStringArray()
+support_overrides/script_enabled=PackedStringArray()
+support_overrides/script_disabled=PackedStringArray()

+ 33 - 0
gui/translation/font/DroidSansJapanese.ttf.import

@@ -0,0 +1,33 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontData"
+uid="uid://rdmplfeo1mfc"
+path="res://.godot/imported/DroidSansJapanese.ttf-de3fc871b57fb078f93cf2bf5d96545a.fontdata"
+
+[deps]
+
+source_file="res://font/DroidSansJapanese.ttf"
+dest_files=["res://.godot/imported/DroidSansJapanese.ttf-de3fc871b57fb078f93cf2bf5d96545a.fontdata"]
+
+[params]
+
+antialiased=true
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+force_autohinter=false
+hinting=1
+subpixel_positioning=1
+embolden=0.0
+transform=Transform2D(1, 0, 0, 1, 0, 0)
+oversampling=0.0
+compress=true
+opentype_feature_overrides={}
+preload/char_ranges=PackedStringArray()
+preload/glyph_ranges=PackedStringArray()
+preload/configurations=PackedStringArray()
+support_overrides/language_enabled=PackedStringArray()
+support_overrides/language_disabled=PackedStringArray()
+support_overrides/script_enabled=PackedStringArray()
+support_overrides/script_disabled=PackedStringArray()

+ 33 - 0
gui/translation/font/DroidSansThai.ttf.import

@@ -0,0 +1,33 @@
+[remap]
+
+importer="font_data_dynamic"
+type="FontData"
+uid="uid://ctmwkt7kh6cst"
+path="res://.godot/imported/DroidSansThai.ttf-91e10bcf58a298496a7fd92e1d4cd8c4.fontdata"
+
+[deps]
+
+source_file="res://font/DroidSansThai.ttf"
+dest_files=["res://.godot/imported/DroidSansThai.ttf-91e10bcf58a298496a7fd92e1d4cd8c4.fontdata"]
+
+[params]
+
+antialiased=true
+multichannel_signed_distance_field=false
+msdf_pixel_range=8
+msdf_size=48
+force_autohinter=false
+hinting=1
+subpixel_positioning=1
+embolden=0.0
+transform=Transform2D(1, 0, 0, 1, 0, 0)
+oversampling=0.0
+compress=true
+opentype_feature_overrides={}
+preload/char_ranges=PackedStringArray()
+preload/glyph_ranges=PackedStringArray()
+preload/configurations=PackedStringArray()
+support_overrides/language_enabled=PackedStringArray()
+support_overrides/language_disabled=PackedStringArray()
+support_overrides/script_enabled=PackedStringArray()
+support_overrides/script_disabled=PackedStringArray()

+ 4 - 1
gui/translation/hello_en.wav.import

@@ -2,6 +2,7 @@
 
 importer="wav"
 type="AudioStreamSample"
+uid="uid://d3e12qtu6rlb6"
 path="res://.godot/imported/hello_en.wav-27ed59f2d75c1ba813ab0abd069b6758.sample"
 
 [deps]
@@ -17,5 +18,7 @@ force/max_rate=false
 force/max_rate_hz=44100
 edit/trim=true
 edit/normalize=true
-edit/loop=false
+edit/loop_mode=0
+edit/loop_begin=0
+edit/loop_end=-1
 compress/mode=0

+ 4 - 1
gui/translation/hello_es.wav.import

@@ -2,6 +2,7 @@
 
 importer="wav"
 type="AudioStreamSample"
+uid="uid://s18obcimx61r"
 path="res://.godot/imported/hello_es.wav-64fe245556f8642a1881ae257bd123f2.sample"
 
 [deps]
@@ -17,5 +18,7 @@ force/max_rate=false
 force/max_rate_hz=44100
 edit/trim=true
 edit/normalize=true
-edit/loop=false
+edit/loop_mode=0
+edit/loop_begin=0
+edit/loop_end=-1
 compress/mode=0

+ 4 - 1
gui/translation/hello_jp.wav.import

@@ -2,6 +2,7 @@
 
 importer="wav"
 type="AudioStreamSample"
+uid="uid://7fh3dentieog"
 path="res://.godot/imported/hello_jp.wav-c31fbd7870b4b969789cb01f208809ac.sample"
 
 [deps]
@@ -17,5 +18,7 @@ force/max_rate=false
 force/max_rate_hz=44100
 edit/trim=true
 edit/normalize=true
-edit/loop=false
+edit/loop_mode=0
+edit/loop_begin=0
+edit/loop_end=-1
 compress/mode=0

+ 13 - 15
gui/translation/icon.png.import

@@ -1,8 +1,9 @@
 [remap]
 
 importer="texture"
-type="StreamTexture2D"
-path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
+type="CompressedTexture2D"
+uid="uid://8uut26begycn"
+path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
 metadata={
 "vram_texture": false
 }
@@ -10,26 +11,23 @@ metadata={
 [deps]
 
 source_file="res://icon.png"
-dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"]
+dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
 
 [params]
 
 compress/mode=0
 compress/lossy_quality=0.7
-compress/hdr_mode=0
+compress/hdr_compression=1
 compress/bptc_ldr=0
 compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
 process/fix_alpha_border=true
 process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
 process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 13 - 11
gui/translation/project.godot

@@ -6,7 +6,7 @@
 ;   [section] ; section goes between []
 ;   param=value ; assign values to parameters
 
-config_version=4
+config_version=5
 
 [application]
 
@@ -15,17 +15,26 @@ config/description="A demo showing how Godot seamlessly enables
 the use of localized resources and texts."
 run/main_scene="res://translation_demo.tscn"
 config/icon="res://icon.png"
+config/features=PackedStringArray("4.0")
 
 [display]
 
-window/dpi/allow_hidpi=true
-window/stretch/mode="2d"
+window/stretch/mode="canvas_items"
 window/stretch/aspect="expand"
 
 [gdnative]
 
 singletons=[]
 
+[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/locale_filter_mode=0
+
 [locale]
 
 translation_remaps={
@@ -34,13 +43,6 @@ translation_remaps={
 }
 translations=PackedStringArray("res://text.en.translation", "res://text.es.translation", "res://text.ja.translation")
 
-[memory]
-
-multithread/thread_rid_pool_prealloc=60
-
 [rendering]
 
-quality/driver/driver_name="GLES2"
-vram_compression/import_etc=true
-vram_compression/import_etc2=false
-environment/default_clear_color=Color(0.145098, 0.145098, 0.164706, 1)
+vulkan/rendering/back_end=1

+ 13 - 15
gui/translation/speaker.png.import

@@ -1,8 +1,9 @@
 [remap]
 
 importer="texture"
-type="StreamTexture2D"
-path="res://.godot/imported/speaker.png-045bf6684b83b55b088824f14e175d16.stex"
+type="CompressedTexture2D"
+uid="uid://bbdxdamxifokx"
+path="res://.godot/imported/speaker.png-045bf6684b83b55b088824f14e175d16.ctex"
 metadata={
 "vram_texture": false
 }
@@ -10,26 +11,23 @@ metadata={
 [deps]
 
 source_file="res://speaker.png"
-dest_files=["res://.godot/imported/speaker.png-045bf6684b83b55b088824f14e175d16.stex"]
+dest_files=["res://.godot/imported/speaker.png-045bf6684b83b55b088824f14e175d16.ctex"]
 
 [params]
 
 compress/mode=0
 compress/lossy_quality=0.7
-compress/hdr_mode=0
+compress/hdr_compression=1
 compress/bptc_ldr=0
 compress/normal_map=0
-flags/repeat=0
-flags/filter=true
-flags/mipmaps=false
-flags/anisotropic=false
-flags/srgb=2
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
 process/fix_alpha_border=true
 process/premult_alpha=false
-process/HDR_as_SRGB=false
-process/invert_color=false
 process/normal_map_invert_y=false
-stream=false
-size_limit=0
-detect_3d=true
-svg/scale=1.0
+process/hdr_as_srgb=false
+process/size_limit=0
+detect_3d/compress_to=1

+ 1 - 1
gui/translation/text.csv

@@ -1,3 +1,3 @@
-,en,es,ja
+KEYS,en,es,ja
 KEY_HELLO,Hello!,Hola!,こんにちは
 KEY_PUSH,Push Me!,Aprétame!,押す

+ 1 - 0
gui/translation/text.csv.import

@@ -2,6 +2,7 @@
 
 importer="csv_translation"
 type="Translation"
+uid="uid://dyudr7sc6obqu"
 
 [deps]
 

+ 12 - 13
gui/translation/translation_demo.tscn

@@ -1,10 +1,10 @@
-[gd_scene load_steps=6 format=2]
+[gd_scene load_steps=6 format=3 uid="uid://7bhrbgdbrped"]
 
-[ext_resource path="res://translation_demo.gd" type="Script" id=1]
-[ext_resource path="res://font/droid_sans.tres" type="Font" id=2]
-[ext_resource path="res://speaker.png" type="Texture2D" id=3]
-[ext_resource path="res://flag_uk.png" type="Texture2D" id=4]
-[ext_resource path="res://hello_en.wav" type="AudioStream" id=5]
+[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"]
 anchor_left = 0.5
@@ -17,7 +17,7 @@ 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="."]
 offset_left = 32.0
@@ -53,7 +53,6 @@ offset_right = 804.0
 offset_bottom = 312.0
 size_flags_horizontal = 2
 size_flags_vertical = 0
-custom_fonts/font = ExtResource( 2 )
 text = "This is a demo of how a game can be internationalized.
 Translations are created in a CSV file and then imported into Godot.
 
@@ -76,7 +75,7 @@ offset_top = 381.0
 offset_right = 324.0
 offset_bottom = 400.0
 size_flags_vertical = 0
-custom_fonts/font = ExtResource( 2 )
+theme_override_fonts/font = ExtResource( "2_fnagj" )
 text = "KEY_HELLO"
 
 [node name="PlayAudio" type="Button" parent="."]
@@ -84,19 +83,19 @@ offset_left = 243.0
 offset_top = 442.0
 offset_right = 475.0
 offset_bottom = 467.0
-custom_fonts/font = ExtResource( 2 )
+theme_override_fonts/font = ExtResource( "2_fnagj" )
 text = "KEY_PUSH"
-icon = ExtResource( 3 )
+icon = ExtResource( "3" )
 
 [node name="Flag" type="TextureRect" parent="."]
 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" )
 
 [connection signal="pressed" from="English" to="." method="_on_english_pressed"]
 [connection signal="pressed" from="Spanish" to="." method="_on_spanish_pressed"]