Translation Demo
This commit is contained in:
parent
17ccd8d9b7
commit
dc3d0bdf38
10 changed files with 53 additions and 0 deletions
BIN
demos/gui/translation/controls.scn
Normal file
BIN
demos/gui/translation/controls.scn
Normal file
Binary file not shown.
8
demos/gui/translation/engine.cfg
Normal file
8
demos/gui/translation/engine.cfg
Normal file
|
@ -0,0 +1,8 @@
|
|||
[application]
|
||||
|
||||
name="Translation Demo"
|
||||
main_scene="res://main.scn"
|
||||
|
||||
[locale]
|
||||
|
||||
translations=["res://translations/text.en.xl", "res://translations/text.es.xl", "res://translations/text.ja.xl"]
|
42
demos/gui/translation/main.gd
Normal file
42
demos/gui/translation/main.gd
Normal file
|
@ -0,0 +1,42 @@
|
|||
|
||||
extends Panel
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
func _ready():
|
||||
# Initialization here
|
||||
pass
|
||||
|
||||
|
||||
|
||||
func _goto_scene():
|
||||
var s = load("res://controls.scn")
|
||||
var si = s.instance()
|
||||
get_parent().add_child(si)
|
||||
queue_free()
|
||||
pass
|
||||
|
||||
|
||||
func _on_system_pressed():
|
||||
#will autodetect based on system, then fall back
|
||||
#to english if not found
|
||||
_goto_scene()
|
||||
|
||||
#NOTE: Changling locale will not change the text in the controls,
|
||||
# The scene must be reloaded for changes to take effect.
|
||||
|
||||
func _on_english_pressed():
|
||||
TranslationServer.set_locale("en")
|
||||
_goto_scene()
|
||||
|
||||
|
||||
func _on_spanish_pressed():
|
||||
TranslationServer.set_locale("es")
|
||||
_goto_scene()
|
||||
|
||||
|
||||
func _on_japanese_pressed():
|
||||
TranslationServer.set_locale("ja")
|
||||
_goto_scene()
|
BIN
demos/gui/translation/main.scn
Normal file
BIN
demos/gui/translation/main.scn
Normal file
Binary file not shown.
BIN
demos/gui/translation/noto.fnt
Normal file
BIN
demos/gui/translation/noto.fnt
Normal file
Binary file not shown.
BIN
demos/gui/translation/notosans.otf
Normal file
BIN
demos/gui/translation/notosans.otf
Normal file
Binary file not shown.
3
demos/gui/translation/text.csv
Normal file
3
demos/gui/translation/text.csv
Normal file
|
@ -0,0 +1,3 @@
|
|||
,en,es,ja
|
||||
KEY_HELLO,Hello!,Hola!,こんにちは
|
||||
KEY_PUSH,Push Me!,Aprétame!,私をプッシュ
|
|
BIN
demos/gui/translation/translations/text.en.xl
Normal file
BIN
demos/gui/translation/translations/text.en.xl
Normal file
Binary file not shown.
BIN
demos/gui/translation/translations/text.es.xl
Normal file
BIN
demos/gui/translation/translations/text.es.xl
Normal file
Binary file not shown.
BIN
demos/gui/translation/translations/text.ja.xl
Normal file
BIN
demos/gui/translation/translations/text.ja.xl
Normal file
Binary file not shown.
Loading…
Reference in a new issue