translation_demo.tscn 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. [gd_scene load_steps=6 format=3 uid="uid://7bhrbgdbrped"]
  2. [ext_resource type="Script" path="res://translation_demo.gd" id="1"]
  3. [ext_resource type="Font" path="res://font/droid_sans.tres" id="2_fnagj"]
  4. [ext_resource type="Texture2D" uid="uid://bbdxdamxifokx" path="res://speaker.png" id="3"]
  5. [ext_resource type="Texture2D" uid="uid://cxbco5txqcf40" path="res://flag_uk.png" id="4"]
  6. [ext_resource type="AudioStream" uid="uid://d3e12qtu6rlb6" path="res://hello_en.wav" id="5"]
  7. [node name="TranslationDemo" type="Control"]
  8. anchor_left = 0.5
  9. anchor_top = 0.5
  10. anchor_right = 0.5
  11. anchor_bottom = 0.5
  12. offset_left = -512.0
  13. offset_top = -300.0
  14. offset_right = 512.0
  15. offset_bottom = 300.0
  16. size_flags_horizontal = 2
  17. size_flags_vertical = 2
  18. script = ExtResource( "1" )
  19. [node name="English" type="Button" parent="."]
  20. offset_left = 32.0
  21. offset_top = 64.0
  22. offset_right = 192.0
  23. offset_bottom = 88.0
  24. size_flags_horizontal = 2
  25. size_flags_vertical = 2
  26. text = "Use English"
  27. [node name="Spanish" type="Button" parent="."]
  28. offset_left = 32.0
  29. offset_top = 112.0
  30. offset_right = 192.0
  31. offset_bottom = 136.0
  32. size_flags_horizontal = 2
  33. size_flags_vertical = 2
  34. text = "Use Spanish"
  35. [node name="Japanese" type="Button" parent="."]
  36. offset_left = 32.0
  37. offset_top = 160.0
  38. offset_right = 192.0
  39. offset_bottom = 184.0
  40. size_flags_horizontal = 2
  41. size_flags_vertical = 2
  42. text = "Use Japanese"
  43. [node name="Description" type="Label" parent="."]
  44. offset_left = 243.0
  45. offset_top = 42.0
  46. offset_right = 804.0
  47. offset_bottom = 312.0
  48. size_flags_horizontal = 2
  49. size_flags_vertical = 0
  50. text = "This is a demo of how a game can be internationalized.
  51. Translations are created in a CSV file and then imported into Godot.
  52. Using a TTF/OTF font with CJK is required for this demo to run. One is provided
  53. in the font/ folder that you can use for your games.
  54. Godot allows internationalized text to change automatically when the locale is
  55. modified. Resources can also be set internationalized alternatives and replaced
  56. automatically on locale change."
  57. [node name="HSeparator" type="HSeparator" parent="."]
  58. offset_left = 33.0
  59. offset_top = 330.0
  60. offset_right = 1001.0
  61. offset_bottom = 370.0
  62. [node name="HelloText" type="Label" parent="."]
  63. offset_left = 246.0
  64. offset_top = 381.0
  65. offset_right = 324.0
  66. offset_bottom = 400.0
  67. size_flags_vertical = 0
  68. theme_override_fonts/font = ExtResource( "2_fnagj" )
  69. text = "KEY_HELLO"
  70. [node name="PlayAudio" type="Button" parent="."]
  71. offset_left = 243.0
  72. offset_top = 442.0
  73. offset_right = 475.0
  74. offset_bottom = 467.0
  75. theme_override_fonts/font = ExtResource( "2_fnagj" )
  76. text = "KEY_PUSH"
  77. icon = ExtResource( "3" )
  78. [node name="Flag" type="TextureRect" parent="."]
  79. offset_left = 85.0
  80. offset_top = 382.0
  81. offset_right = 213.0
  82. offset_bottom = 467.0
  83. texture = ExtResource( "4" )
  84. [node name="Audio" type="AudioStreamPlayer" parent="."]
  85. stream = ExtResource( "5" )
  86. [node name="TextLabel" type="Label" parent="."]
  87. anchor_left = 0.5
  88. anchor_top = 0.5
  89. anchor_right = 0.5
  90. anchor_bottom = 0.5
  91. offset_left = 21.0
  92. offset_top = 80.0
  93. offset_right = 487.0
  94. offset_bottom = 255.0
  95. grow_horizontal = 2
  96. grow_vertical = 2
  97. theme_override_fonts/font = ExtResource( "2_fnagj" )
  98. text = "This text is being translated through script:
  99. "
  100. __meta__ = {
  101. "_edit_layout_mode": 1,
  102. "_edit_use_custom_anchors": false
  103. }
  104. [connection signal="pressed" from="English" to="." method="_on_english_pressed"]
  105. [connection signal="pressed" from="Spanish" to="." method="_on_spanish_pressed"]
  106. [connection signal="pressed" from="Japanese" to="." method="_on_japanese_pressed"]
  107. [connection signal="pressed" from="PlayAudio" to="." method="_on_play_pressed"]