ot_localize.nim 722 B

12345678910111213141516171819202122232425262728293031323334
  1. import unittest, json
  2. import sigui, siwin, localize
  3. test "localize":
  4. var locale = globalLocale.property
  5. locale[] = locale(
  6. "ru", "",
  7. parseLocaleTable %*{
  8. "sigui": {
  9. "tests/ot_localize.nim": {
  10. "Hello, world!": {
  11. "": "Привет, мир!"
  12. },
  13. },
  14. }
  15. }
  16. )
  17. let win = newOpenglWindow(size=ivec2(1280, 720), title="Hello sigui").newUiWindow
  18. win.clearColor = "202020"
  19. const typefaceFile = staticRead "Roboto-Regular.ttf"
  20. let typeface = parseTtf(typefaceFile)
  21. win.makeLayout:
  22. - UiText():
  23. this.centerIn(parent)
  24. font = typeface.withSize(32)
  25. color = "fff"
  26. text := locale[].tr"Hello, world!"
  27. run win.siwinWindow