translation_demo_po.tscn 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. [gd_scene load_steps=6 format=3 uid="uid://u6cnwv1b1mhl"]
  2. [ext_resource type="Script" path="res://translation_po.gd" id="1_u1syg"]
  3. [ext_resource type="FontFile" uid="uid://b0887xnwnkgju" path="res://fonts/droid_sans.tres" id="3_0g48e"]
  4. [ext_resource type="Texture2D" uid="uid://bk44e7bkr4w4l" path="res://images/speaker.webp" id="3_x3031"]
  5. [ext_resource type="Texture2D" uid="uid://cy06u7558clgu" path="res://images/flag_uk.webp" id="4_2she1"]
  6. [ext_resource type="AudioStream" uid="uid://ciept8j0x21to" path="res://audio/hello_en.wav" id="6_v8u3c"]
  7. [node name="TranslationDemoPO" type="Panel"]
  8. anchors_preset = 8
  9. anchor_left = 0.5
  10. anchor_top = 0.5
  11. anchor_right = 0.5
  12. anchor_bottom = 0.5
  13. offset_left = -512.0
  14. offset_top = -300.0
  15. offset_right = 512.0
  16. offset_bottom = 300.0
  17. size_flags_horizontal = 2
  18. size_flags_vertical = 2
  19. script = ExtResource("1_u1syg")
  20. [node name="Title" type="Label" parent="."]
  21. layout_mode = 0
  22. offset_left = 422.0
  23. offset_top = 12.0
  24. offset_right = 602.0
  25. offset_bottom = 50.0
  26. theme_override_colors/font_color = Color(0.788235, 0.54902, 0.933333, 1)
  27. theme_override_font_sizes/font_size = 24
  28. text = "PO Example"
  29. [node name="English" type="Button" parent="."]
  30. layout_mode = 0
  31. offset_left = 32.0
  32. offset_top = 81.592
  33. offset_right = 192.0
  34. offset_bottom = 112.592
  35. size_flags_horizontal = 2
  36. size_flags_vertical = 2
  37. text = "Use English"
  38. [node name="Spanish" type="Button" parent="."]
  39. layout_mode = 0
  40. offset_left = 32.0
  41. offset_top = 129.592
  42. offset_right = 192.0
  43. offset_bottom = 160.592
  44. size_flags_horizontal = 2
  45. size_flags_vertical = 2
  46. text = "Use Spanish"
  47. [node name="Japanese" type="Button" parent="."]
  48. layout_mode = 0
  49. offset_left = 32.0
  50. offset_top = 177.592
  51. offset_right = 192.0
  52. offset_bottom = 208.592
  53. size_flags_horizontal = 2
  54. size_flags_vertical = 2
  55. text = "Use Japanese"
  56. [node name="Description" type="Label" parent="."]
  57. layout_mode = 0
  58. offset_left = 243.0
  59. offset_top = 64.592
  60. offset_right = 929.0
  61. offset_bottom = 334.592
  62. size_flags_horizontal = 2
  63. size_flags_vertical = 0
  64. text = "This second demo showcases localization using gettext (PO/POT) files.
  65. The resouce remapping process is the same with CSV. The in-game text translation
  66. process is also the same – use keys to fetch the appropriate translation.
  67. The main difference between PO files and CSV files is the way both of them store
  68. the translated data in their files. Have a look at the \"translations/po\"
  69. and \"translations/csv\" folders to see the files involved."
  70. [node name="HSeparator" type="HSeparator" parent="."]
  71. layout_mode = 0
  72. offset_left = 33.0
  73. offset_top = 354.0
  74. offset_right = 1001.0
  75. offset_bottom = 394.0
  76. [node name="HelloText" type="Label" parent="."]
  77. layout_mode = 0
  78. offset_left = 246.0
  79. offset_top = 405.0
  80. offset_right = 325.0
  81. offset_bottom = 429.0
  82. size_flags_vertical = 0
  83. theme_override_fonts/font = ExtResource("3_0g48e")
  84. text = "Hello!"
  85. [node name="PlayAudio" type="Button" parent="."]
  86. layout_mode = 0
  87. offset_left = 243.0
  88. offset_top = 466.0
  89. offset_right = 475.0
  90. offset_bottom = 498.0
  91. theme_override_fonts/font = ExtResource("3_0g48e")
  92. text = "Push Me!"
  93. icon = ExtResource("3_x3031")
  94. [node name="Flag" type="TextureRect" parent="."]
  95. layout_mode = 0
  96. offset_left = 85.0
  97. offset_top = 406.0
  98. offset_right = 213.0
  99. offset_bottom = 491.0
  100. texture = ExtResource("4_2she1")
  101. [node name="Audio" type="AudioStreamPlayer2D" parent="."]
  102. stream = ExtResource("6_v8u3c")
  103. [node name="GoToCSVTranslationDemo" type="Button" parent="."]
  104. layout_mode = 0
  105. offset_left = 761.0
  106. offset_top = 545.0
  107. offset_right = 1000.0
  108. offset_bottom = 576.0
  109. text = "Go to CSV Translation Demo"
  110. [connection signal="pressed" from="English" to="." method="_on_english_pressed"]
  111. [connection signal="pressed" from="Spanish" to="." method="_on_spanish_pressed"]
  112. [connection signal="pressed" from="Japanese" to="." method="_on_japanese_pressed"]
  113. [connection signal="pressed" from="PlayAudio" to="." method="_on_play_audio_pressed"]
  114. [connection signal="pressed" from="GoToCSVTranslationDemo" to="." method="_on_go_to_csv_translation_demo_pressed"]