Pseudolocalization.gd 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. extends Control
  2. func _ready():
  3. $Main/Pseudolocalization_options/accents.button_pressed = ProjectSettings.get("internationalization/pseudolocalization/replace_with_accents")
  4. $Main/Pseudolocalization_options/toggle.button_pressed = TranslationServer.pseudolocalization_enabled
  5. $Main/Pseudolocalization_options/fakebidi.button_pressed = ProjectSettings.get("internationalization/pseudolocalization/fake_bidi")
  6. $Main/Pseudolocalization_options/doublevowels.button_pressed = ProjectSettings.get("internationalization/pseudolocalization/double_vowels")
  7. $Main/Pseudolocalization_options/override.button_pressed = ProjectSettings.get("internationalization/pseudolocalization/override")
  8. $Main/Pseudolocalization_options/skipplaceholders.button_pressed = ProjectSettings.get("internationalization/pseudolocalization/skip_placeholders")
  9. $Main/Pseudolocalization_options/prefix/TextEdit.text = ProjectSettings.get("internationalization/pseudolocalization/prefix")
  10. $Main/Pseudolocalization_options/suffix/TextEdit.text = ProjectSettings.get("internationalization/pseudolocalization/suffix")
  11. $Main/Pseudolocalization_options/exp_ratio/TextEdit.text = str(ProjectSettings.get("internationalization/pseudolocalization/expansion_ratio"))
  12. func _on_accents_toggled(button_pressed):
  13. ProjectSettings.set("internationalization/pseudolocalization/replace_with_accents", button_pressed)
  14. TranslationServer.reload_pseudolocalization()
  15. func _on_toggle_toggled(button_pressed):
  16. TranslationServer.pseudolocalization_enabled = button_pressed
  17. func _on_fakebidi_toggled(button_pressed):
  18. ProjectSettings.set("internationalization/pseudolocalization/fake_bidi", button_pressed)
  19. TranslationServer.reload_pseudolocalization()
  20. func _on_prefix_changed():
  21. ProjectSettings.set("internationalization/pseudolocalization/prefix", $Main/Pseudolocalization_options/prefix/TextEdit.text)
  22. TranslationServer.reload_pseudolocalization()
  23. func _on_suffix_changed():
  24. ProjectSettings.set("internationalization/pseudolocalization/suffix", $Main/Pseudolocalization_options/suffix/TextEdit.text)
  25. TranslationServer.reload_pseudolocalization()
  26. func _on_Pseudolocalize_pressed():
  27. $Main/Pseudolocalizer/Result.text = TranslationServer.pseudolocalize($Main/Pseudolocalizer/Key.text)
  28. func _on_doublevowels_toggled(button_pressed):
  29. ProjectSettings.set("internationalization/pseudolocalization/double_vowels", button_pressed)
  30. TranslationServer.reload_pseudolocalization()
  31. func _on_expansion_ratio_text_changed():
  32. var ratio = ($Main/Pseudolocalization_options/exp_ratio/TextEdit.text).to_float()
  33. if ratio > 1:
  34. ratio = 1
  35. $Main/Pseudolocalization_options/exp_ratio/TextEdit.text = str(ratio)
  36. if ratio < 0:
  37. ratio = 0
  38. $Main/Pseudolocalization_options/exp_ratio/TextEdit.text = str(ratio)
  39. ProjectSettings.set("internationalization/pseudolocalization/expansion_ratio", ratio)
  40. TranslationServer.reload_pseudolocalization()
  41. func _on_override_toggled(button_pressed):
  42. ProjectSettings.set("internationalization/pseudolocalization/override", button_pressed)
  43. TranslationServer.reload_pseudolocalization()
  44. func _on_skipplaceholders_toggled(button_pressed):
  45. ProjectSettings.set("internationalization/pseudolocalization/skip_placeholders", button_pressed)
  46. TranslationServer.reload_pseudolocalization()