tnlshello.pp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {
  2. rstconv -i tnlshello.rst -o tnlshello_ru_UTF8.pot
  3. msgfmt tnlshello_ru_UTF8.pot
  4. mv messages.mo ru
  5. }
  6. program nlshello;
  7. {$mode objfpc}
  8. uses
  9. gettext, ncurses;
  10. {$linklib c}
  11. procedure setlocale(cat : integer; p : pchar); cdecl; external 'c';
  12. const
  13. LC_ALL = 6;
  14. resourcestring
  15. hello_world = 'Hello world!';
  16. press_key = 'Press any key to continue!';
  17. var
  18. win : pWINDOW;
  19. begin
  20. setlocale(LC_ALL, '');
  21. try
  22. initscr();
  23. start_color;
  24. noecho;
  25. win:= newwin ( 10, COLS - 20, 5, 10);
  26. init_pair(1,COLOR_WHITE,COLOR_BLUE);
  27. init_pair(2,COLOR_RED,COLOR_BLUE);
  28. wbkgd(win, COLOR_PAIR(1));
  29. erase;
  30. refresh;
  31. box(win, ACS_VLINE, ACS_HLINE);
  32. wrefresh(win);
  33. mvwaddstr(win,1,3, curses_version);
  34. TranslateResourcestrings('%s/messages.mo');
  35. wattron(win,A_BLINK OR A_BOLD OR COLOR_PAIR(2));
  36. mvwaddstr(win,3,3, PChar(hello_world));
  37. wattroff(win,A_BLINK OR A_BOLD OR COLOR_PAIR(2));
  38. mvwaddstr(win,5,3, PChar(press_key));
  39. wrefresh(win);
  40. getch();
  41. finally
  42. endwin();
  43. end;
  44. end.