Lines 27-35
Link Here
|
27 |
import curses.ascii |
27 |
import curses.ascii |
28 |
from portage import settings as port_settings |
28 |
from portage import settings as port_settings |
29 |
from glob import glob |
29 |
from glob import glob |
|
|
30 |
import gettext |
31 |
import locale |
30 |
|
32 |
|
|
|
33 |
# Setup default locale |
34 |
locale.setlocale(locale.LC_ALL, '') |
35 |
|
36 |
# Setup gettext. Note that lgettext() is used instead of gettext() |
37 |
# because it always returns strings encoded with the preferred system |
38 |
# encoding, not encoded with the same codeset used in the translation |
39 |
# file |
40 |
gettext.textdomain('elogv') |
41 |
_ = gettext.lgettext |
42 |
|
31 |
# This text is used on the in-line help |
43 |
# This text is used on the in-line help |
32 |
helptext = """ |
44 |
helptext = _(""" |
33 |
Elogv is a portage elog viewer based on curses and python, |
45 |
Elogv is a portage elog viewer based on curses and python, |
34 |
you can use these keys to control the behavior of the program: |
46 |
you can use these keys to control the behavior of the program: |
35 |
|
47 |
|
Lines 55-61
Link Here
|
55 |
- / -> starts a search prompt, write a string and will be showed the next |
67 |
- / -> starts a search prompt, write a string and will be showed the next |
56 |
package that contains your string, use ESC to exit |
68 |
package that contains your string, use ESC to exit |
57 |
- q -> quit |
69 |
- q -> quit |
58 |
""" |
70 |
""") |
59 |
|
71 |
|
60 |
(normal,selected,einfo,ewarn,eerror,elog) = range(6) |
72 |
(normal,selected,einfo,ewarn,eerror,elog) = range(6) |
61 |
|
73 |
|
Lines 218-224
Link Here
|
218 |
# Screen Look&Feel |
230 |
# Screen Look&Feel |
219 |
self.screen.border() |
231 |
self.screen.border() |
220 |
self.screen.hline(self.height/2,1, "_", self.width-2) |
232 |
self.screen.hline(self.height/2,1, "_", self.width-2) |
221 |
m = " Press F1 or h to show the help screen " |
233 |
m = _(" Press F1 or h to show the help screen ") |
222 |
self.screen.addstr(self.height-1, self.width-len(m)-1, m) |
234 |
self.screen.addstr(self.height-1, self.width-len(m)-1, m) |
223 |
self.screen.refresh() |
235 |
self.screen.refresh() |
224 |
|
236 |
|
Lines 402-408
Link Here
|
402 |
pass |
414 |
pass |
403 |
|
415 |
|
404 |
if self.f: |
416 |
if self.f: |
405 |
self.log_win.addstr(self.height/2-3, self.width-15, "Continue...", |
417 |
self.log_win.addstr(self.height/2-3, self.width-15, _("Continue..."), |
406 |
curses.color_pair(normal)) |
418 |
curses.color_pair(normal)) |
407 |
|
419 |
|
408 |
self.log_win.refresh() |
420 |
self.log_win.refresh() |
Lines 477-485
Link Here
|
477 |
self.change_usel(self.packages.index(x),False) |
489 |
self.change_usel(self.packages.index(x),False) |
478 |
break |
490 |
break |
479 |
else: |
491 |
else: |
480 |
self.screen.addstr(self.height-2,2,"Not Found!", |
492 |
self.screen.addstr(self.height-2,2,_("Not Found!"), |
481 |
curses.color_pair(eerror)) |
493 |
curses.color_pair(eerror)) |
482 |
|
494 |
|
483 |
if __name__ == "__main__": |
495 |
if __name__ == "__main__": |
484 |
if "--help" in sys.argv: |
496 |
if "--help" in sys.argv: |
485 |
print helptext |
497 |
print helptext |
Lines 495-508
Link Here
|
495 |
try: |
507 |
try: |
496 |
curses.wrapper(ElogViewer) |
508 |
curses.wrapper(ElogViewer) |
497 |
except TermTooSmall: |
509 |
except TermTooSmall: |
498 |
print "Your terminal window is too small, try to enlarge it" |
510 |
print _("Your terminal window is too small, try to enlarge it") |
499 |
sys.exit(1) |
511 |
sys.exit(1) |
500 |
except NoLogFiles: |
512 |
except NoLogFiles: |
501 |
print "There aren't any elog files on",elogdir |
513 |
print _("There aren't any elog files on"),elogdir |
502 |
sys.exit(1) |
514 |
sys.exit(1) |
503 |
except CannotOpenElogdir: |
515 |
except CannotOpenElogdir: |
504 |
print "Cannot open",elogdir |
516 |
print _("Cannot open"),elogdir |
505 |
print "Please check if the directory exists and if it's readable by your user." |
517 |
print _("Please check if the directory exists and if it's readable by your user.") |
506 |
sys.exit(1) |
518 |
sys.exit(1) |
507 |
except KeyboardInterrupt: |
519 |
except KeyboardInterrupt: |
508 |
pass |
520 |
pass |