tnlshello.pp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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, initc;
  10. procedure setlocale(cat : integer; p : pchar); cdecl; external clib;
  11. const
  12. LC_ALL = 6;
  13. resourcestring
  14. hello_world = 'Hello world!';
  15. press_key = 'Press any key to continue!';
  16. var
  17. win : pWINDOW;
  18. begin
  19. setlocale(LC_ALL, '');
  20. try
  21. initscr();
  22. start_color;
  23. noecho;
  24. win:= newwin ( 10, COLS - 20, 5, 10);
  25. init_pair(1,COLOR_WHITE,COLOR_BLUE);
  26. init_pair(2,COLOR_RED,COLOR_BLUE);
  27. wbkgd(win, COLOR_PAIR(1));
  28. erase;
  29. refresh;
  30. box(win, ACS_VLINE, ACS_HLINE);
  31. wrefresh(win);
  32. mvwaddstr(win,1,3, curses_version);
  33. TranslateResourcestrings('%s/messages.mo');
  34. wattron(win,A_BLINK OR A_BOLD OR COLOR_PAIR(2));
  35. mvwaddstr(win,3,3, PChar(hello_world));
  36. wattroff(win,A_BLINK OR A_BOLD OR COLOR_PAIR(2));
  37. mvwaddstr(win,5,3, PChar(press_key));
  38. wrefresh(win);
  39. getch();
  40. finally
  41. endwin();
  42. end;
  43. end.