-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Evgeniy Goroshkin edited this page Apr 8, 2018
·
4 revisions
Localization for Monkey2
This is easy to use lightweight system that allow you
to keep all texts localized on-the-fly.
Example of file with translations:
{
"langs":["ru","en"],
"default":"en",
"ru":{
"app-title":"Пример локализации",
"button-remove":"Удалить",
"button-close":"Закрыть",
"hello-world":"Привет, мир!",
"switch-lang":"Переключить язык",
"hint":"Нажмите Enter чтобы переключить язык"
},
"en":{
"app-title":"Localization demo",
"button-remove":"Remove",
"button-close":"Close",
"hello-world":"Hello world!",
"switch-lang":"Switch lang",
"hint":"Press Enter to switch lang"
}
}
Usage in code:
' grab hint text into variable
_hint=Localized( "hint" )
' bind lambda function
Localized( "hello-world",Lambda( t:String )
_label.Text=t
End )
For more complex examples look at demo projects.
