diff options
author | Wichert Akkerman <wakkerma@debian.org> | 1999-10-25 15:29:18 +0000 |
---|---|---|
committer | Wichert Akkerman <wakkerma@debian.org> | 1999-10-25 15:29:18 +0000 |
commit | 2870d2379548359a17a068b906f4a9cbb5055c2f (patch) | |
tree | 87de435e47d71183edf6a6b6f4996ddb215ee378 /dselect | |
parent | 0eefcacb9266106e2b1be3af29439c3711245bed (diff) | |
download | dpkg-2870d2379548359a17a068b906f4a9cbb5055c2f.tar.gz |
Add gettext-support to dselect
Diffstat (limited to 'dselect')
-rw-r--r-- | dselect/basecmds.cc | 16 | ||||
-rw-r--r-- | dselect/baselist.cc | 54 | ||||
-rw-r--r-- | dselect/bindings.cc | 70 | ||||
-rw-r--r-- | dselect/main.cc | 71 | ||||
-rw-r--r-- | dselect/methlist.cc | 42 | ||||
-rw-r--r-- | dselect/method.cc | 50 | ||||
-rw-r--r-- | dselect/methparse.cc | 86 | ||||
-rw-r--r-- | dselect/pkgcmds.cc | 10 | ||||
-rw-r--r-- | dselect/pkgdepcon.cc | 52 | ||||
-rw-r--r-- | dselect/pkgdisplay.cc | 154 | ||||
-rw-r--r-- | dselect/pkginfo.cc | 30 | ||||
-rw-r--r-- | dselect/pkglist.cc | 36 | ||||
-rw-r--r-- | dselect/pkgsublist.cc | 38 | ||||
-rw-r--r-- | dselect/pkgtop.cc | 56 |
14 files changed, 403 insertions, 362 deletions
diff --git a/dselect/basecmds.cc b/dselect/basecmds.cc index bacaac113..95f1b1134 100644 --- a/dselect/basecmds.cc +++ b/dselect/basecmds.cc @@ -86,7 +86,7 @@ void baselist::kd_redraw() { // RFSH(whatinfowin); /* fixme-ncurses: why does ncurses need this ? */ clearok(curscr,TRUE); redrawall(); - if (debug) fprintf(debug,"baselist[%p]::kd_redraw() done\n",this); + if (debug) fprintf(debug,_("baselist[%p]::kd_redraw() done\n"),this); } void baselist::kd_searchagain() { @@ -96,7 +96,7 @@ void baselist::kd_searchagain() { void baselist::kd_search() { werase(querywin); - mvwaddstr(querywin,0,0, "Search for ? "); + mvwaddstr(querywin,0,0, _("Search for ? ")); echo(); /* fixme: ncurses documentation or implementation */ /* fixme: make / RET do `search again' and / DEL to abort */ if (wgetnstr(querywin,searchstring,sizeof(searchstring)-1) == ERR) @@ -123,13 +123,13 @@ void baselist::displayhelp(const struct helpmenuentry *helpmenu, int key) { attrset(list_attr); mvaddstr(1,0, hme->msg->text); attrset(title_attr); - mvaddstr(0,0, "Help: "); + mvaddstr(0,0, _("Help: ")); addstr(hme->msg->title); getyx(stdscr,y,x); while (++x<maxx) addch(' '); attrset(thisstate_attr); mvaddstr(maxy-1,0, -"? = help menu Space = exit help . = next help or a help page key " +_("? = help menu Space = exit help . = next help or a help page key ") ); getyx(stdscr,y,x); while (++x<maxx) addch(' '); @@ -137,7 +137,7 @@ void baselist::displayhelp(const struct helpmenuentry *helpmenu, int key) { attrset(A_NORMAL); nextkey= hme[1].key; } else { - mvaddstr(1,1, "Help information is available under the following topics:"); + mvaddstr(1,1, _("Help information is available under the following topics:")); for (i=0, hme=helpmenu; hme->key; hme++,i++) { attrset(A_BOLD); mvaddch(i+3,3, hme->key); @@ -145,13 +145,13 @@ void baselist::displayhelp(const struct helpmenuentry *helpmenu, int key) { mvaddstr(i+3,6, hme->msg->title); } mvaddstr(i+4,1, - "Press a key from the list above, Space to exit help,\n" - " or `.' (full stop) to read each help page in turn. "); + _("Press a key from the list above, Space to exit help,\n" + " or `.' (full stop) to read each help page in turn. ")); nextkey= helpmenu[0].key; } refresh(); key= getch(); - if (key == EOF) ohshite("error reading keyboard in help"); + if (key == EOF) ohshite(_("error reading keyboard in help")); if (key == ' ') { break; } else if (key == '?') { diff --git a/dselect/baselist.cc b/dselect/baselist.cc index e22737738..a40fec7ca 100644 --- a/dselect/baselist.cc +++ b/dselect/baselist.cc @@ -49,16 +49,16 @@ void baselist::sigwinchhandler(int) { p->enddisplay(); endwin(); initscr(); p->startdisplay(); - if (doupdate() == ERR) ohshite("doupdate in SIGWINCH handler failed"); + if (doupdate() == ERR) ohshite(_("doupdate in SIGWINCH handler failed")); } static void cu_sigwinch(int, void **argv) { struct sigaction *osigactp= (struct sigaction*)argv[0]; sigset_t *oblockedp= (sigset_t*)argv[1]; - if (sigaction(SIGWINCH,osigactp,0)) ohshite("failed to restore old SIGWINCH sigact"); + if (sigaction(SIGWINCH,osigactp,0)) ohshite(_("failed to restore old SIGWINCH sigact")); delete osigactp; - if (sigprocmask(SIG_SETMASK,oblockedp,0)) ohshite("failed to restore old signal mask"); + if (sigprocmask(SIG_SETMASK,oblockedp,0)) ohshite(_("failed to restore old signal mask")); delete oblockedp; } @@ -68,17 +68,17 @@ void baselist::setupsigwinch() { osigactp= new(struct sigaction); oblockedp= new(sigset_t); - if (sigprocmask(0,0,oblockedp)) ohshite("failed to get old signal mask"); - if (sigaction(SIGWINCH,0,osigactp)) ohshite("failed to get old SIGWINCH sigact"); + if (sigprocmask(0,0,oblockedp)) ohshite(_("failed to get old signal mask")); + if (sigaction(SIGWINCH,0,osigactp)) ohshite(_("failed to get old SIGWINCH sigact")); push_cleanup(cu_sigwinch,~0, 0,0, 2,(void*)osigactp,(void*)oblockedp); - if (sigprocmask(SIG_BLOCK,&sigwinchset,0)) ohshite("failed to block SIGWINCH"); + if (sigprocmask(SIG_BLOCK,&sigwinchset,0)) ohshite(_("failed to block SIGWINCH")); memset(&nsigact,0,sizeof(nsigact)); nsigact.sa_handler= sigwinchhandler; sigemptyset(&nsigact.sa_mask); nsigact.sa_flags= SA_INTERRUPT; - if (sigaction(SIGWINCH,&nsigact,0)) ohshite("failed to set new SIGWINCH sigact"); + if (sigaction(SIGWINCH,&nsigact,0)) ohshite(_("failed to set new SIGWINCH sigact")); } void baselist::setheights() { @@ -105,7 +105,7 @@ void baselist::setheights() { } void baselist::startdisplay() { - if (debug) fprintf(debug,"baselist[%p]::startdisplay()\n",this); + if (debug) fprintf(debug,_("baselist[%p]::startdisplay()\n"),this); cbreak(); noecho(); nonl(); keypad(stdscr,TRUE); clear(); wnoutrefresh(stdscr); @@ -114,7 +114,7 @@ void baselist::startdisplay() { if (init_pair(1,COLOR_WHITE,COLOR_BLACK) != OK || init_pair(2,COLOR_WHITE,COLOR_RED) != OK || init_pair(3,COLOR_WHITE,COLOR_BLUE) != OK) - ohshite("failed to allocate colour pairs"); + ohshite(_("failed to allocate colour pairs")); list_attr= COLOR_PAIR(1); listsel_attr= list_attr|A_REVERSE; title_attr= COLOR_PAIR(2); @@ -144,30 +144,30 @@ void baselist::startdisplay() { setwidths(); titlewin= newwin(1,xmax, 0,0); - if (!titlewin) ohshite("failed to create title window"); + if (!titlewin) ohshite(_("failed to create title window")); wattrset(titlewin,title_attr); whatinfowin= newwin(1,xmax, whatinfo_row,0); - if (!whatinfowin) ohshite("failed to create whatinfo window"); + if (!whatinfowin) ohshite(_("failed to create whatinfo window")); wattrset(whatinfowin,whatinfo_attr); listpad= newpad(nitems+1, total_width); - if (!listpad) ohshite("failed to create baselist pad"); + if (!listpad) ohshite(_("failed to create baselist pad")); colheadspad= newpad(1, total_width); - if (!colheadspad) ohshite("failed to create heading pad"); + if (!colheadspad) ohshite(_("failed to create heading pad")); wattrset(colheadspad,colheads_attr); thisstatepad= newpad(1, total_width); - if (!thisstatepad) ohshite("failed to create thisstate pad"); + if (!thisstatepad) ohshite(_("failed to create thisstate pad")); wattrset(thisstatepad,thisstate_attr); infopad= newpad(MAX_DISPLAY_INFO, total_width); - if (!infopad) ohshite("failed to create info pad"); + if (!infopad) ohshite(_("failed to create info pad")); wattrset(infopad,info_attr); querywin= newwin(1,xmax,ymax-1,0); - if (!querywin) ohshite("failed to create query window"); + if (!querywin) ohshite(_("failed to create query window")); if (cursorline >= topofscreen + list_height) topofscreen= cursorline; if (topofscreen > nitems - list_height) topofscreen= nitems - list_height; @@ -179,12 +179,12 @@ void baselist::startdisplay() { if (debug) fprintf(debug, - "baselist::startdisplay() done ...\n\n" + _("baselist::startdisplay() done ...\n\n" " xmax=%d, ymax=%d;\n\n" " title_height=%d, colheads_height=%d, list_height=%d;\n" " thisstate_height=%d, info_height=%d, whatinfo_height=%d;\n\n" " colheads_row=%d, thisstate_row=%d, info_row=%d;\n" - " whatinfo_row=%d, list_row=%d;\n\n", + " whatinfo_row=%d, list_row=%d;\n\n"), xmax, ymax, title_height, colheads_height, list_height, thisstate_height, info_height, whatinfo_height, @@ -220,7 +220,7 @@ void baselist::redraw1item(int index) { baselist::baselist(keybindings *kb) { if (debug) - fprintf(debug,"baselist[%p]::baselist()\n",this); + fprintf(debug,_("baselist[%p]::baselist()\n"),this); bindings= kb; nitems= 0; @@ -235,7 +235,7 @@ baselist::baselist(keybindings *kb) { } void baselist::itd_keys() { - whatinfovb("keybindings"); + whatinfovb(_("keybindings")); const int givek= xmax/3; bindings->describestart(); @@ -243,7 +243,7 @@ void baselist::itd_keys() { while ((ta= bindings->describenext()) != 0) { const char **tap= ta+1; for (;;) { - waddstr(infopad, *tap); + waddstr(infopad, gettext(*tap)); tap++; if (!*tap) break; waddstr(infopad, ", "); } @@ -258,7 +258,7 @@ void baselist::itd_keys() { void baselist::dosearch() { int offset, index, searchlen; searchlen= strlen(searchstring); - if (debug) fprintf(debug,"packagelist[%p]::dosearch(); searchstring=`%s' len=%d\n", + if (debug) fprintf(debug,_("packagelist[%p]::dosearch(); searchstring=`%s' len=%d\n"), this,searchstring,searchlen); for (offset=1, index=greaterint(topofscreen,cursorline+1); offset<nitems; @@ -290,14 +290,14 @@ void baselist::refreshinfo() { mywerase(whatinfowin); mvwaddstr(whatinfowin,0,0, whatinfovb.string()); if (infolines > info_height) { - wprintw(whatinfowin," -- %d%%, press ", + wprintw(whatinfowin,_(" -- %d%%, press "), (int)((infotopofscreen + info_height) * 100.0 / infolines)); if (infotopofscreen + info_height < infolines) { - wprintw(whatinfowin,"%s for more", bindings->find("iscrollon")); + wprintw(whatinfowin,_("%s for more"), bindings->find("iscrollon")); if (infotopofscreen) waddstr(whatinfowin, ", "); } if (infotopofscreen) - wprintw(whatinfowin, "%s to go back",bindings->find("iscrollback")); + wprintw(whatinfowin, _("%s to go back"),bindings->find("iscrollback")); waddch(whatinfowin,'.'); } wnoutrefresh(whatinfowin); @@ -306,7 +306,7 @@ void baselist::refreshinfo() { void baselist::wordwrapinfo(int offset, const char *m) { int usemax= xmax-5; - if (debug) fprintf(debug,"baselist[%p]::wordwrapinfo(%d, `%s')\n",this,offset,m); + if (debug) fprintf(debug,_("baselist[%p]::wordwrapinfo(%d, `%s')\n"),this,offset,m); int wrapping=0; for (;;) { int offleft=offset; while (*m == ' ' && offleft>0) { m++; offleft--; } @@ -352,7 +352,7 @@ void baselist::wordwrapinfo(int offset, const char *m) { if (!p) break; m= ++p; } - if (debug) fprintf(debug,"baselist[%p]::wordwrapinfo() done\n",this); + if (debug) fprintf(debug,_("baselist[%p]::wordwrapinfo() done\n"),this); } baselist::~baselist() { } diff --git a/dselect/bindings.cc b/dselect/bindings.cc index ce7c0b688..39d294706 100644 --- a/dselect/bindings.cc +++ b/dselect/bindings.cc @@ -68,11 +68,11 @@ int keybindings::bind(int key, const char *action) { const char *keybindings::find(const char *action) { binding *b; for (b=bindings; b && strcmp(action,b->interp->action); b=b->next); - if (!b) return "[not bound]"; + if (!b) return _("[not bound]"); const char *n= key2name(b->key); if (n) return n; static char buf[50]; - sprintf(buf,"[unk: %d]",b->key); + sprintf(buf,_("[unk: %d]"),b->key); return buf; } @@ -126,41 +126,41 @@ keybindings::~keybindings() { const keybindings::description keybindings::descriptions[]= { // Actions which apply to both types of list. - { "iscrollon", "Scroll onwards through help/information" }, - { "iscrollback", "Scroll backwards through help/information" }, - { "up", "Move up" }, - { "down", "Move down" }, - { "top", "Go to top of list" }, - { "bottom", "Go to end of list" }, - { "help", "Request help (cycle through help screens)" }, - { "info", "Cycle through information displays" }, - { "redraw", "Redraw display" }, - { "scrollon1", "Scroll onwards through list by 1 line" }, - { "scrollback1", "Scroll backwards through list by 1 line" }, - { "iscrollon1", "Scroll onwards through help/information by 1 line" }, - { "iscrollback1", "Scroll backwards through help/information by 1 line" }, - { "scrollon", "Scroll onwards through list" }, - { "scrollback", "Scroll backwards through list" }, + { "iscrollon", N_("Scroll onwards through help/information") }, + { "iscrollback", N_("Scroll backwards through help/information") }, + { "up", N_("Move up") }, + { "down", N_("Move down") }, + { "top", N_("Go to top of list") }, + { "bottom", N_("Go to end of list") }, + { "help", N_("Request help (cycle through help screens)") }, + { "info", N_("Cycle through information displays") }, + { "redraw", N_("Redraw display") }, + { "scrollon1", N_("Scroll onwards through list by 1 line") }, + { "scrollback1", N_("Scroll backwards through list by 1 line") }, + { "iscrollon1", N_("Scroll onwards through help/information by 1 line") }, + { "iscrollback1", N_("Scroll backwards through help/information by 1 line") }, + { "scrollon", N_("Scroll onwards through list") }, + { "scrollback", N_("Scroll backwards through list") }, // Actions which apply only to lists of packages. - { "install", "Mark package(s) for installation" }, - { "remove", "Mark package(s) for deinstallation" }, - { "purge", "Mark package(s) for deinstall and purge" }, - { "morespecific", "Make highlight more specific" }, - { "lessspecific", "Make highlight less specific" }, - { "search", "Search for a package whose name contains a string" }, - { "searchagain", "Repeat last search." }, - { "swaporder", "Swap sort order priority/section" }, - { "quitcheck", "Quit, confirming, and checking dependencies" }, - { "quitnocheck", "Quit, confirming without check" }, - { "quitrejectsug", "Quit, rejecting conflict/dependency suggestions" }, - { "abortnocheck", "Abort - quit without making changes" }, - { "revert", "Revert to old state for all packages" }, - { "revertsuggest", "Revert to suggested state for all packages" }, - { "revertdirect", "Revert to directly requested state for all packages" }, + { "install", N_("Mark package(s) for installation") }, + { "remove", N_("Mark package(s) for deinstallation") }, + { "purge", N_("Mark package(s) for deinstall and purge") }, + { "morespecific", N_("Make highlight more specific") }, + { "lessspecific", N_("Make highlight less specific") }, + { "search", N_("Search for a package whose name contains a string") }, + { "searchagain", N_("Repeat last search.") }, + { "swaporder", N_("Swap sort order priority/section") }, + { "quitcheck", N_("Quit, confirming, and checking dependencies") }, + { "quitnocheck", N_("Quit, confirming without check") }, + { "quitrejectsug", N_("Quit, rejecting conflict/dependency suggestions") }, + { "abortnocheck", N_("Abort - quit without making changes") }, + { "revert", N_("Revert to old state for all packages") }, + { "revertsuggest", N_("Revert to suggested state for all packages") }, + { "revertdirect", N_("Revert to directly requested state for all packages") }, // Actions which apply only to lists of methods. - { "select-and-quit", "Select currently-highlighted access method" }, - { "abort", "Quit without changing selected access method" }, - { 0, 0 } + { "select-and-quit", N_("Select currently-highlighted access method") }, + { "abort", N_("Quit without changing selected access method") }, + { 0, 0 } }; diff --git a/dselect/main.cc b/dselect/main.cc index 3522e7dd3..d400655d2 100644 --- a/dselect/main.cc +++ b/dselect/main.cc @@ -48,7 +48,7 @@ extern "C" { #include "pkglist.h" const char thisname[]= DSELECT; -const char printforhelp[]= "Type " DSELECT " --help for help."; +const char printforhelp[]= N_("Type " DSELECT " --help for help."); modstatdb_rw readwrite; const char *admindir= ADMINDIR; @@ -63,36 +63,36 @@ struct menuentry { }; static const menuentry menuentries[]= { - { "access", "Choose the access method to use.", &urq_setup }, - { "update", "Update list of available packages, if possible.", &urq_update }, - { "select", "Request which packages you want on your system.", &urq_list }, - { "install", "Install and upgrade wanted packages.", &urq_install }, - { "config", "Configure any packages that are unconfigured.", &urq_config }, - { "remove", "Remove unwanted software.", &urq_remove }, - { "quit", "Quit dselect.", &urq_quit }, - { "menu", 0, &urq_menu }, - { 0 } + { N_("access"), N_("Choose the access method to use."), &urq_setup }, + { N_("update"), N_("Update list of available packages, if possible."), &urq_update }, + { N_("select"), N_("Request which packages you want on your system."), &urq_list }, + { N_("install"), N_("Install and upgrade wanted packages."), &urq_install }, + { N_("config"), N_("Configure any packages that are unconfigured."), &urq_config }, + { N_("remove"), N_("Remove unwanted software."), &urq_remove }, + { N_("quit"), N_("Quit dselect."), &urq_quit }, + { N_("menu"), 0, &urq_menu }, + { 0 } }; static const char programdesc[]= - "Debian Linux `" DSELECT "' package handling frontend."; + N_("Debian Linux `" DSELECT "' package handling frontend."); -static const char copyrightstring[]= +static const char copyrightstring[]= N_( "Version " DPKG_VERSION_ARCH ". Copyright (C) 1994-1996 Ian Jackson. This is\n" "free software; see the GNU General Public Licence version 2 or later for\n" - "copying conditions. There is NO warranty. See dselect --licence for details.\n"; + "copying conditions. There is NO warranty. See dselect --licence for details.\n"); static void printversion(void) { - if (fprintf(stdout,"%s\n%s",programdesc,copyrightstring) == EOF) werr("stdout"); + if (fprintf(stdout,"%s\n%s",gettext(programdesc),gettext(copyrightstring)) == EOF) werr("stdout"); } static void usage(void) { - if (!fputs - ("Usage: dselect [options]\n" + if (!fputs( + _("Usage: dselect [options]\n" " dselect [options] action ...\n" "Options: --admindir <directory> (default is /var/lib/dpkg)\n" " --help --version --licence --debug <file> | -D<file> | -D\n" - "Actions: access update select install config remove quit menu\n", + "Actions: access update select install config remove quit menu\n"), stdout)) werr("stdout"); } @@ -134,7 +134,7 @@ extern "C" { static void setdebug(const struct cmdinfo*, const char *v) { debug= fopen(v,"a"); - if (!debug) ohshite("couldn't open debug file `%.255s'\n",v); + if (!debug) ohshite(_("couldn't open debug file `%.255s'\n"),v); setvbuf(debug,0,_IONBF,0); } @@ -160,12 +160,12 @@ void curseson() { if (!cup || !smso) { endwin(); if (!cup) - fputs("Terminal does not appear to support cursor addressing.\n",stderr); + fputs(_("Terminal does not appear to support cursor addressing.\n"),stderr); if (!smso) - fputs("Terminal does not appear to support highlighting.\n",stderr); - fputs("Set your TERM variable correctly, use a better terminal,\n" - "or make do with the per-package management tool " DPKG ".\n",stderr); - ohshit("terminal lacks necessary features, giving up"); + fputs(_("Terminal does not appear to support highlighting.\n"),stderr); + fputs(_("Set your TERM variable correctly, use a better terminal,\n" + "or make do with the per-package management tool " DPKG ".\n"),stderr); + ohshit(_("terminal lacks necessary features, giving up")); } } cursesareon= 1; @@ -209,10 +209,11 @@ urqresult urq_list(void) { void dme(int i, int so) { char buf[120]; const menuentry *me= &menuentries[i]; + const char* option = gettext(me->option); sprintf(buf," %c %d. [%c]%-10.10s %-80.80s ", so ? '*' : ' ', i, - toupper(me->option[0]), me->option+1, - me->menuent); + toupper(option[0]), option+1, + gettext(me->menuent)); int y,x; getmaxyx(stdscr,y,x); @@ -230,7 +231,7 @@ int refreshmenu(void) { clear(); attrset(A_BOLD); - mvaddnstr(0,0, programdesc,x-1); + mvaddnstr(0,0, gettext(programdesc),x-1); attrset(A_NORMAL); const struct menuentry *mep; int i; @@ -238,12 +239,12 @@ int refreshmenu(void) { dme(i,0); attrset(A_BOLD); - addstr("\n\n" + addstr(_("\n\n" "Use ^P and ^N, cursor keys, initial letters, or digits to select;\n" - "Press ENTER to confirm selection. ^L to redraw screen.\n\n"); + "Press ENTER to confirm selection. ^L to redraw screen.\n\n")); attrset(A_NORMAL); - addstr(copyrightstring); + addstr(gettext(copyrightstring)); return i; } @@ -256,7 +257,7 @@ urqresult urq_menu(void) { dme(0,1); for (;;) { refresh(); - c= getch(); if (c==ERR) ohshite("failed to getch in main menu"); + c= getch(); if (c==ERR) ohshite(_("failed to getch in main menu")); if (c==C('n') || c==KEY_DOWN || c==' ') { dme(cursor,0); cursor++; cursor %= entries; dme(cursor,1); } else if (c==C('p') || c==KEY_UP || c==C('h') || @@ -272,7 +273,7 @@ urqresult urq_menu(void) { case urqr_fail: break; default: - internerr("unknown menufn"); + internerr(_("unknown menufn")); } refreshmenu(); dme(cursor,1); } else if (c==C('l')) { @@ -286,7 +287,7 @@ urqresult urq_menu(void) { } } else if (isalpha(c)) { c= tolower(c); - for (i=0; i<entries && menuentries[i].option[0] != c; i++); + for (i=0; i<entries && gettext(menuentries[i].option)[0] != c; i++); if (i < entries) { dme(cursor,0); cursor=i; dme(cursor,1); } else { @@ -306,6 +307,10 @@ urqresult urq_quit(void) { int main(int, const char *const *argv) { jmp_buf ejbuf; + setlocale(LC_ALL, ""); + bindtextdomain(PACKAGE, LOCALEDIR); + textdomain(PACKAGE); + #if CAN_RESIZE (void) signal(SIGWINCH, adjust); /* arrange interrupts to resize */ #endif @@ -323,7 +328,7 @@ int main(int, const char *const *argv) { while ((a= *argv++) != 0) { const menuentry *me; for (me= menuentries; me->option && strcmp(me->option,a); me++); - if (!me->option) badusage("unknown action string `%.50s'",a); + if (!me->option) badusage(_("unknown action string `%.50s'"),a); me->fn(); } } else { diff --git a/dselect/methlist.cc b/dselect/methlist.cc index f995189a7..cb063f124 100644 --- a/dselect/methlist.cc +++ b/dselect/methlist.cc @@ -44,13 +44,13 @@ const char *methodlist::itemname(int index) { void methodlist::kd_abort() { } void methodlist::kd_quit() { - if (debug) fprintf(debug,"methodlist[%p]::kd_quit() setting coption=%p\n", + if (debug) fprintf(debug,_("methodlist[%p]::kd_quit() setting coption=%p\n"), this, table[cursorline]); coption= table[cursorline]; } void methodlist::setwidths() { - if (debug) fprintf(debug,"methodlist[%p]::setwidths()\n",this); + if (debug) fprintf(debug,_("methodlist[%p]::setwidths()\n"),this); status_width= 1; gap_width= 1; @@ -65,7 +65,7 @@ void methodlist::setwidths() { void methodlist::redrawtitle() { if (title_height) { mywerase(titlewin); - mvwaddnstr(titlewin,0,0,"dselect - list of access methods",xmax); + mvwaddnstr(titlewin,0,0,_("dselect - list of access methods"),xmax); wnoutrefresh(titlewin); } } @@ -74,7 +74,7 @@ void methodlist::redrawthisstate() { if (!thisstate_height) return; mywerase(thisstatepad); wprintw(thisstatepad, - "Access method `%s'.", + _("Access method `%s'."), table[cursorline]->name); pnoutrefresh(thisstatepad, 0,0, thisstate_row,0, thisstate_row, lesserint(total_width - 1, xmax - 1)); @@ -108,8 +108,8 @@ void methodlist::redrawcolheads() { wattrset(colheadspad,colheads_attr); mywerase(colheadspad); mvwaddstr(colheadspad,0,0, " "); - mvwaddnstr(colheadspad,0,name_column, "Abbrev.", name_width); - mvwaddnstr(colheadspad,0,description_column, "Description", description_width); + mvwaddnstr(colheadspad,0,name_column, _("Abbrev."), name_width); + mvwaddnstr(colheadspad,0,description_column, _("Description"), description_width); } refreshcolheads(); } @@ -118,7 +118,7 @@ methodlist::methodlist() : baselist(&methodlistbindings) { int newcursor= -1; if (debug) - fprintf(debug,"methodlist[%p]::methodlist()\n",this); + fprintf(debug,_("methodlist[%p]::methodlist()\n"),this); table= new struct option*[noptions]; @@ -133,11 +133,11 @@ methodlist::methodlist() : baselist(&methodlistbindings) { setcursor(newcursor); if (debug) - fprintf(debug,"methodlist[%p]::methodlist done; noptions=%d\n", this, noptions); + fprintf(debug,_("methodlist[%p]::methodlist done; noptions=%d\n"), this, noptions); } methodlist::~methodlist() { - if (debug) fprintf(debug,"methodlist[%p]::~methodlist()\n",this); + if (debug) fprintf(debug,_("methodlist[%p]::~methodlist()\n"),this); delete[] table; } @@ -145,24 +145,24 @@ quitaction methodlist::display() { int response; const keybindings::interpretation *interp; - if (debug) fprintf(debug,"methodlist[%p]::display()\n",this); + if (debug) fprintf(debug,_("methodlist[%p]::display()\n"),this); setupsigwinch(); startdisplay(); - if (debug) fprintf(debug,"methodlist[%p]::display() entering loop\n",this); + if (debug) fprintf(debug,_("methodlist[%p]::display() entering loop\n"),this); for (;;) { if (whatinfo_height) wcursyncup(whatinfowin); - if (doupdate() == ERR) ohshite("doupdate failed"); + if (doupdate() == ERR) ohshite(_("doupdate failed")); signallist= this; - if (sigprocmask(SIG_UNBLOCK,&sigwinchset,0)) ohshite("failed to unblock SIGWINCH"); + if (sigprocmask(SIG_UNBLOCK,&sigwinchset,0)) ohshite(_("failed to unblock SIGWINCH")); response= getch(); - if (sigprocmask(SIG_BLOCK,&sigwinchset,0)) ohshite("failed to re-block SIGWINCH"); - if (response == ERR) ohshite("getch failed"); + if (sigprocmask(SIG_BLOCK,&sigwinchset,0)) ohshite(_("failed to re-block SIGWINCH")); + if (response == ERR) ohshite(_("getch failed")); interp= (*bindings)(response); if (debug) - fprintf(debug,"methodlist[%p]::display() response=%d interp=%s\n", - this,response, interp ? interp->action : "[none]"); + fprintf(debug,_("methodlist[%p]::display() response=%d interp=%s\n"), + this,response, interp ? interp->action : _("[none]")); if (!interp) { beep(); continue; } (this->*(interp->mfn))(); if (interp->qa != qa_noquit) break; @@ -170,13 +170,13 @@ quitaction methodlist::display() { pop_cleanup(ehflag_normaltidy); // unset the SIGWINCH handler enddisplay(); - if (debug) fprintf(debug,"methodlist[%p]::display() done\n",this); + if (debug) fprintf(debug,_("methodlist[%p]::display() done\n"),this); return interp->qa; } void methodlist::itd_description() { - whatinfovb("explanation of "); + whatinfovb(_("explanation of ")); whatinfovb(table[cursorline]->name); wattrset(infopad,info_headattr); @@ -186,7 +186,7 @@ void methodlist::itd_description() { wattrset(infopad,info_attr); const char *m= table[cursorline]->description; - if (!m || !*m) m= "No explanation available."; + if (!m || !*m) m= _("No explanation available."); waddstr(infopad,"\n\n"); wordwrapinfo(0,m); } @@ -196,7 +196,7 @@ void methodlist::redrawinfo() { whatinfovb.reset(); werase(infopad); wmove(infopad,0,0); - if (debug) fprintf(debug,"methodlist[%p]::redrawinfo()\n", this); + if (debug) fprintf(debug,_("methodlist[%p]::redrawinfo()\n"), this); itd_description(); diff --git a/dselect/method.cc b/dselect/method.cc index a835d0a50..27e1dc2cf 100644 --- a/dselect/method.cc +++ b/dselect/method.cc @@ -59,7 +59,7 @@ static void cu_unlockmethod(int, void**) { assert(methodlockfile); assert(methlockfd); if (flock(methlockfd,LOCK_UN)) - ohshite("unable to unlock access method area"); + ohshite(_("unable to unlock access method area")); } static enum urqresult ensureoptions(void) { @@ -74,8 +74,8 @@ static enum urqresult ensureoptions(void) { readmethods(*ccpp, &newoptions, &nread); if (!newoptions) { curseson(); - addstr("No access methods are available.\n\n" - "Press RETURN to continue."); + addstr(_("No access methods are available.\n\n" + "Press RETURN to continue.")); refresh(); getch(); return urqr_fail; } @@ -97,14 +97,14 @@ static void lockmethod(void) { methlockfd= open(methodlockfile, O_RDWR|O_CREAT|O_TRUNC, 0660); if (methlockfd == -1) { if (errno == EPERM) - ohshit("you do not have permission to change the access method"); - ohshite("unable to open/create access method lockfile"); + ohshit(_("you do not have permission to change the access method")); + ohshite(_("unable to open/create access method lockfile")); } } if (flock(methlockfd,LOCK_EX|LOCK_NB)) { if (errno == EWOULDBLOCK || errno == EAGAIN) - ohshit("the access method area is already locked"); - ohshite("unable to lock access method area"); + ohshit(_("the access method area is already locked")); + ohshite(_("unable to lock access method area")); } push_cleanup(cu_unlockmethod,~0, 0,0, 0); } @@ -117,7 +117,7 @@ void cu_restoresignals(int, void**) { int i; for (i=0; i<NCATCHSIGNALS; i++) if (sigaction(catchsignals[i],&uncatchsignal[i],0)) - fprintf(stderr,"error un-catching signal %d: %s\n", + fprintf(stderr,_("error un-catching signal %d: %s\n"), catchsignals[i],strerror(errno)); } @@ -135,20 +135,20 @@ urqresult falliblesubprocess(const char *exepath, const char *name, catchsig.sa_flags= 0; for (i=0; i<NCATCHSIGNALS; i++) if (sigaction(catchsignals[i],&catchsig,&uncatchsignal[i])) - ohshite("unable to ignore signal %d before running %.250s", + ohshite(_("unable to ignore signal %d before running %.250s"), catchsignals[i], name); push_cleanup(cu_restoresignals,~0, 0,0, 0); if (!(c1= m_fork())) { cu_restoresignals(0,0); execvp(exepath,(char* const*) args); - ohshite("unable to run %.250s process `%.250s'",name,exepath); + ohshite(_("unable to run %.250s process `%.250s'"),name,exepath); } while ((cr= waitpid(c1,&status,0)) == -1) - if (errno != EINTR) ohshite("unable to wait for %.250s",name); + if (errno != EINTR) ohshite(_("unable to wait for %.250s"),name); if (cr != c1) - ohshit("got wrong child's status - asked for %ld, got %ld",(long)c1,(long)cr); + ohshit(_("got wrong child's status - asked for %ld, got %ld"),(long)c1,(long)cr); pop_cleanup(ehflag_normaltidy); @@ -159,25 +159,25 @@ urqresult falliblesubprocess(const char *exepath, const char *name, fprintf(stderr,"\n%s ",name); if (WIFEXITED(status)) { i= WEXITSTATUS(status); - fprintf(stderr,"returned error exit status %d.\n",i); + fprintf(stderr,_("returned error exit status %d.\n"),i); } else if (WIFSIGNALED(status)) { i= WTERMSIG(status); if (i == SIGINT) { - fprintf(stderr,"was interrupted.\n"); + fprintf(stderr,_("was interrupted.\n")); } else { - fprintf(stderr,"was terminated by a signal: %s.\n",strsignal(i)); + fprintf(stderr,_("was terminated by a signal: %s.\n"),strsignal(i)); } if (WCOREDUMP(status)) - fprintf(stderr,"(It left a coredump.)\n"); + fprintf(stderr,_("(It left a coredump.)\n")); } else { - fprintf(stderr,"failed with an unknown wait return code %d.\n",status); + fprintf(stderr,_("failed with an unknown wait return code %d.\n"),status); } - fprintf(stderr,"Press RETURN to continue.\n"); + fprintf(stderr,_("Press RETURN to continue.\n")); if (ferror(stderr)) - ohshite("write error on standard error"); + ohshite(_("write error on standard error")); do { c= fgetc(stdin); } while (c != EOF && c != '\n'); if (c == EOF) - ohshite("error reading acknowledgement of program failure message"); + ohshite(_("error reading acknowledgement of program failure message")); return urqr_fail; } @@ -200,8 +200,8 @@ static urqresult runscript(const char *exepath, const char *name) { ur= falliblesubprocess(coption->meth->path,name,fallibleargs); } else { curseson(); - addstr("No access method is selected/configured.\n\n" - "Press RETURN to continue."); + addstr(_("No access method is selected/configured.\n\n" + "Press RETURN to continue.")); refresh(); getch(); ur= urqr_fail; } @@ -211,11 +211,11 @@ static urqresult runscript(const char *exepath, const char *name) { } urqresult urq_update(void) { - return runscript(METHODUPDATESCRIPT,"update available list script"); + return runscript(METHODUPDATESCRIPT,_("update available list script")); } urqresult urq_install(void) { - return runscript(METHODINSTALLSCRIPT,"installation script"); + return runscript(METHODINSTALLSCRIPT,_("installation script")); } static urqresult rundpkgauto(const char *name, const char *dpkgmode) { @@ -261,7 +261,7 @@ urqresult urq_setup(void) { coption->name, 0 }; - ur= falliblesubprocess(coption->meth->path,"query/setup script",fallibleargs); + ur= falliblesubprocess(coption->meth->path,_("query/setup script"),fallibleargs); if (ur == urqr_normal) writecurrentopt(); } else { ur= urqr_fail; diff --git a/dselect/methparse.cc b/dselect/methparse.cc index 4388415cc..913fd2fa7 100644 --- a/dselect/methparse.cc +++ b/dselect/methparse.cc @@ -50,12 +50,12 @@ struct method *methods=0; static void badmethod(const char *pathname, const char *why) NONRETURNING; static void badmethod(const char *pathname, const char *why) { - ohshit("syntax error in method options file `%.250s' -- %s", pathname, why); + ohshit(_("syntax error in method options file `%.250s' -- %s"), pathname, why); } static void eofmethod(const char *pathname, FILE *f, const char *why) NONRETURNING; static void eofmethod(const char *pathname, FILE *f, const char *why) { - if (ferror(f)) ohshite("error reading options file `%.250s'",pathname); + if (ferror(f)) ohshite(_("error reading options file `%.250s'"),pathname); badmethod(pathname,why); } @@ -83,21 +83,21 @@ void readmethods(const char *pathbase, option **optionspp, int *nread) { dir= opendir(pathbuf); if (!dir) { if (errno == ENOENT) return; - ohshite("unable to read `%.250s' directory for reading methods",pathbuf); + ohshite(_("unable to read `%.250s' directory for reading methods"),pathbuf); } - if (debug) fprintf(debug,"readmethods(`%s',...) directory open\n", pathbase); + if (debug) fprintf(debug,_("readmethods(`%s',...) directory open\n"), pathbase); while ((dent= readdir(dir)) != 0) { c= dent->d_name[0]; - if (debug) fprintf(debug,"readmethods(`%s',...) considering `%s' ...\n", + if (debug) fprintf(debug,_("readmethods(`%s',...) considering `%s' ...\n"), pathbase,dent->d_name); if (c != '_' && !isalpha(c)) continue; for (p= dent->d_name+1; (c= *p) != 0 && isalnum(c) && c != '_'; p++); if (c) continue; methodlen= strlen(dent->d_name); if (methodlen > IMETHODMAXLEN) - ohshit("method `%.250s' has name that is too long (%d > %d characters)", + ohshit(_("method `%.250s' has name that is too long (%d > %d characters)"), dent->d_name, methodlen, IMETHODMAXLEN); /* Check if there is a localized version of this method */ @@ -108,13 +108,13 @@ void readmethods(const char *pathbase, option **optionspp, int *nread) { for (ccpp= methodprograms; *ccpp; ccpp++) { strcpy(pathinmeth,*ccpp); if (access(pathbuf,R_OK|X_OK)) - ohshite("unable to access method script `%.250s'",pathbuf); + ohshite(_("unable to access method script `%.250s'"),pathbuf); } - if (debug) fprintf(debug," readmethods(`%s',...) scripts ok\n", pathbase); + if (debug) fprintf(debug,_(" readmethods(`%s',...) scripts ok\n"), pathbase); strcpy(pathinmeth,METHODOPTIONSFILE); names= fopen(pathbuf,"r"); - if (!names) ohshite("unable to read method options file `%.250s'",pathbuf); + if (!names) ohshite(_("unable to read method options file `%.250s'"),pathbuf); meth= new method; meth->name= new char[strlen(dent->d_name)+1]; @@ -127,8 +127,8 @@ void readmethods(const char *pathbase, option **optionspp, int *nread) { meth->back= 0; if (methods) methods->back= meth; methods= meth; - if (debug) fprintf(debug," readmethods(`%s',...) new method" - " name=`%s' path=`%s' pathinmeth=`%s'\n", + if (debug) fprintf(debug,_(" readmethods(`%s',...) new method" + " name=`%s' path=`%s' pathinmeth=`%s'\n"), pathbase, meth->name, meth->path, meth->pathinmeth); while ((c= fgetc(names)) != EOF) { @@ -137,40 +137,40 @@ void readmethods(const char *pathbase, option **optionspp, int *nread) { opt->meth= meth; vb.reset(); do { - if (!isdigit(c)) badmethod(pathbuf,"non-digit where digit wanted"); + if (!isdigit(c)) badmethod(pathbuf,_("non-digit where digit wanted")); vb(c); c= fgetc(names); - if (c == EOF) eofmethod(pathbuf,names,"EOF in index string"); + if (c == EOF) eofmethod(pathbuf,names,_("EOF in index string")); } while (!isspace(c)); if (strlen(vb.string()) > OPTIONINDEXMAXLEN) - badmethod(pathbuf,"index string too long"); + badmethod(pathbuf,_("index string too long")); strcpy(opt->index,vb.string()); do { - if (c == '\n') badmethod(pathbuf,"newline before option name start"); + if (c == '\n') badmethod(pathbuf,_("newline before option name start")); c= fgetc(names); - if (c == EOF) eofmethod(pathbuf,names,"EOF before option name start"); + if (c == EOF) eofmethod(pathbuf,names,_("EOF before option name start")); } while (isspace(c)); vb.reset(); if (!isalpha(c) && c != '_') - badmethod(pathbuf,"nonalpha where option name start wanted"); + badmethod(pathbuf,_("nonalpha where option name start wanted")); do { - if (!isalnum(c) && c != '_') badmethod(pathbuf,"non-alphanum in option name"); + if (!isalnum(c) && c != '_') badmethod(pathbuf,_("non-alphanum in option name")); vb(c); c= fgetc(names); - if (c == EOF) eofmethod(pathbuf,names,"EOF in option name"); + if (c == EOF) eofmethod(pathbuf,names,_("EOF in option name")); } while (!isspace(c)); opt->name= new char[strlen(vb.string())+1]; strcpy(opt->name,vb.string()); do { - if (c == '\n') badmethod(pathbuf,"newline before summary"); + if (c == '\n') badmethod(pathbuf,_("newline before summary")); c= fgetc(names); - if (c == EOF) eofmethod(pathbuf,names,"EOF before summary"); + if (c == EOF) eofmethod(pathbuf,names,_("EOF before summary")); } while (isspace(c)); vb.reset(); do { vb(c); c= fgetc(names); - if (c == EOF) eofmethod(pathbuf,names,"EOF in summary - missing newline"); + if (c == EOF) eofmethod(pathbuf,names,_("EOF in summary - missing newline")); } while (c != '\n'); opt->summary= new char[strlen(vb.string())+1]; strcpy(opt->summary,vb.string()); @@ -180,26 +180,26 @@ void readmethods(const char *pathbase, option **optionspp, int *nread) { descfile= fopen(pathbuf,"r"); if (!descfile) { if (errno != ENOENT) - ohshite("unable to open option description file `%.250s'",pathbuf); + ohshite(_("unable to open option description file `%.250s'"),pathbuf); opt->description= 0; } else { /* descfile != 0 */ if (fstat(fileno(descfile),&stab)) - ohshite("unable to stat option description file `%.250s'",pathbuf); + ohshite(_("unable to stat option description file `%.250s'"),pathbuf); opt->description= new char[stab.st_size+1]; errno=0; unsigned long filelen= stab.st_size; if (fread(opt->description,1,stab.st_size+1,descfile) != filelen) - ohshite("failed to read option description file `%.250s'",pathbuf); + ohshite(_("failed to read option description file `%.250s'"),pathbuf); opt->description[stab.st_size]= 0; if (ferror(descfile)) - ohshite("error during read of option description file `%.250s'",pathbuf); + ohshite(_("error during read of option description file `%.250s'"),pathbuf); fclose(descfile); } strcpy(pathinmeth,METHODOPTIONSFILE); - if (debug) fprintf(debug," readmethods(`%s',...) new option" + if (debug) fprintf(debug,_(" readmethods(`%s',...) new option" " index=`%s' name=`%s' summary=`%.20s'" " strlen(description=%s)=%ld" - " method name=`%s' path=`%s' pathinmeth=`%s'\n", + " method name=`%s' path=`%s' pathinmeth=`%s'\n"), pathbase, opt->index, opt->name, opt->summary, opt->description ? "`...'" : "null", @@ -213,11 +213,11 @@ void readmethods(const char *pathbase, option **optionspp, int *nread) { (*nread)++; } if (ferror(names)) - ohshite("error during read of method options file `%.250s'",pathbuf); + ohshite(_("error during read of method options file `%.250s'"),pathbuf); fclose(names); } closedir(dir); - if (debug) fprintf(debug,"readmethods(`%s',...) done\n", pathbase); + if (debug) fprintf(debug,_("readmethods(`%s',...) done\n"), pathbase); delete[] pathbuf; } @@ -243,28 +243,28 @@ void getcurrentopt() { cmo= fopen(methoptfile,"r"); if (!cmo) { if (errno == ENOENT) return; - ohshite("unable to open current option file `%.250s'",methoptfile); + ohshite(_("unable to open current option file `%.250s'"),methoptfile); } - if (debug) fprintf(debug,"getcurrentopt() cmethopt open\n"); + if (debug) fprintf(debug,_("getcurrentopt() cmethopt open\n")); if (!fgets(methoptbuf,sizeof(methoptbuf),cmo)) { fclose(cmo); return; } if (fgetc(cmo) != EOF) { fclose(cmo); return; } if (!feof(cmo)) { fclose(cmo); return; } - if (debug) fprintf(debug,"getcurrentopt() cmethopt eof\n"); + if (debug) fprintf(debug,_("getcurrentopt() cmethopt eof\n")); fclose(cmo); - if (debug) fprintf(debug,"getcurrentopt() cmethopt read\n"); + if (debug) fprintf(debug,_("getcurrentopt() cmethopt read\n")); l= strlen(methoptbuf); if (!l || methoptbuf[l-1] != '\n') return; methoptbuf[--l]= 0; - if (debug) fprintf(debug,"getcurrentopt() cmethopt len and newline\n"); + if (debug) fprintf(debug,_("getcurrentopt() cmethopt len and newline\n")); p= strchr(methoptbuf,' '); if (!p) return; - if (debug) fprintf(debug,"getcurrentopt() cmethopt space\n"); + if (debug) fprintf(debug,_("getcurrentopt() cmethopt space\n")); *p++= 0; - if (debug) fprintf(debug,"getcurrentopt() cmethopt meth name `%s'\n", methoptbuf); + if (debug) fprintf(debug,_("getcurrentopt() cmethopt meth name `%s'\n"), methoptbuf); for (meth= methods; meth && strcmp(methoptbuf,meth->name); meth= meth->next); if (!meth) return; - if (debug) fprintf(debug,"getcurrentopt() cmethopt meth found; opt `%s'\n",p); + if (debug) fprintf(debug,_("getcurrentopt() cmethopt meth found; opt `%s'\n"),p); for (opt= options; opt && (opt->meth != meth || strcmp(p,opt->name)); opt= opt->next); if (!opt) return; - if (debug) fprintf(debug,"getcurrentopt() cmethopt opt found\n"); + if (debug) fprintf(debug,_("getcurrentopt() cmethopt opt found\n")); coption= opt; } @@ -281,13 +281,13 @@ void writecurrentopt() { strcpy(newfile+l, NEWDBEXT); } cmo= fopen(newfile,"w"); - if (!cmo) ohshite("unable to open new option file `%.250s'",newfile); + if (!cmo) ohshite(_("unable to open new option file `%.250s'"),newfile); if (fprintf(cmo,"%s %s\n",coption->meth->name,coption->name) == EOF) { fclose(cmo); - ohshite("unable to write new option to `%.250s'",newfile); + ohshite(_("unable to write new option to `%.250s'"),newfile); } if (fclose(cmo)) - ohshite("unable to close new option file `%.250s'",newfile); + ohshite(_("unable to close new option file `%.250s'"),newfile); if (rename(newfile,methoptfile)) - ohshite("unable to install new option as `%.250s'",methoptfile); + ohshite(_("unable to install new option as `%.250s'"),methoptfile); } diff --git a/dselect/pkgcmds.cc b/dselect/pkgcmds.cc index a2e9d2915..1de9e8e27 100644 --- a/dselect/pkgcmds.cc +++ b/dselect/pkgcmds.cc @@ -44,7 +44,7 @@ int packagelist::affectedmatches(struct pkginfo *pkg, struct pkginfo *comparewit case sso_unsorted: break; default: - internerr("unknown statsortorder in affectedmatches"); + internerr(_("unknown statsortorder in affectedmatches")); } if (comparewith->priority != pkginfo::pri_unset && (comparewith->priority != pkg->priority || @@ -136,7 +136,7 @@ void packagelist::kd_purge() { setwant(pkginfo::want_purge); } int would_like_to_install(pkginfo::pkgwant wantvalue, pkginfo *pkg) { /* Returns: 1 for yes, 0 for no, -1 for if they want to preserve an error condition. */ - if (debug) fprintf(debug,"would_like_to_install(%d, %s) status %d\n", + if (debug) fprintf(debug,_("would_like_to_install(%d, %s) status %d\n"), wantvalue,pkg->name,pkg->status); if (wantvalue == pkginfo::want_install) return 1; @@ -157,7 +157,7 @@ void packagelist::kd_swapstatorder() { case sso_avail: statsortorder= sso_state; break; case sso_state: statsortorder= sso_unsorted; break; case sso_unsorted: statsortorder= sso_avail; break; - default: internerr("unknown statsort in kd_swapstatorder"); + default: internerr(_("unknown statsort in kd_swapstatorder")); } resortredisplay(); } @@ -168,7 +168,7 @@ void packagelist::kd_swaporder() { case so_section: sortorder= so_alpha; break; case so_alpha: sortorder= so_priority; break; case so_unsorted: return; - default: internerr("unknown sort in kd_swaporder"); + default: internerr(_("unknown sort in kd_swaporder")); } resortredisplay(); } @@ -204,7 +204,7 @@ void packagelist::kd_versiondisplay() { case vdo_both: versiondisplayopt= vdo_none; break; case vdo_none: versiondisplayopt= vdo_available; break; case vdo_available: versiondisplayopt= vdo_both; break; - default: internerr("unknown versiondisplayopt in kd_versiondisplay"); + default: internerr(_("unknown versiondisplayopt in kd_versiondisplay")); } setwidths(); leftofscreen= 0; diff --git a/dselect/pkgdepcon.cc b/dselect/pkgdepcon.cc index 6b2b7fd3a..5e11470f1 100644 --- a/dselect/pkgdepcon.cc +++ b/dselect/pkgdepcon.cc @@ -49,7 +49,7 @@ pkginfoperfile *packagelist::findinfo(pkginfo *pkg) { pkginfoperfile *r; r= useavailable(pkg) ? &pkg->available : &pkg->installed; if (debug) - fprintf(debug,"packagelist[%p]::findinfo(%s) useavailable=%d\n",this,pkg->name,useavailable(pkg)); + fprintf(debug,_("packagelist[%p]::findinfo(%s) useavailable=%d\n"),this,pkg->name,useavailable(pkg)); if (!r->valid) blankpackageperfile(r); return r; } @@ -78,7 +78,7 @@ int packagelist::resolvesuggest() { // Return 2 if we made a change due to a Recommended, Depends or Conficts, // or 1 if we offered or made a change because of an Optional line. if (debug) - fprintf(debug,"packagelist[%p]::resolvesuggest()\n",this); + fprintf(debug,_("packagelist[%p]::resolvesuggest()\n"),this); int changemade, maxchangemade; maxchangemade= 0; for (;;) { @@ -87,7 +87,7 @@ int packagelist::resolvesuggest() { for (index=0; index<nitems; index++) { if (!table[index]->pkg->name) continue; if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvesuggest() loop[%i] %s / %d\n", + fprintf(debug,_("packagelist[%p]::resolvesuggest() loop[%i] %s / %d\n"), this, index, table[index]->pkg->name, changemade); dependency *depends; for (depends= findinfo(table[index]->pkg)->depends; @@ -103,14 +103,14 @@ int packagelist::resolvesuggest() { changemade= checkdependers(depends->list->ed,changemade); } if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvesuggest() loop[%i] %s / -> %d\n", + fprintf(debug,_("packagelist[%p]::resolvesuggest() loop[%i] %s / -> %d\n"), this, index, table[index]->pkg->name, changemade); } if (!changemade) break; maxchangemade= greaterint(maxchangemade, changemade); } if (debug) - fprintf(debug,"packagelist[%p]::resolvesuggest() done; maxchangemade=%d\n", + fprintf(debug,_("packagelist[%p]::resolvesuggest() done; maxchangemade=%d\n"), this,maxchangemade); return maxchangemade; } @@ -120,7 +120,7 @@ static int dep_update_best_to_change_stop(perpackagestate *& best, pkginfo *tryt if (!trythis->clientdata) return 0; if (depdebug && debug) - fprintf(debug,"update_best_to_change(best=%s{%d}, test=%s{%d});\n", + fprintf(debug,_("update_best_to_change(best=%s{%d}, test=%s{%d});\n"), best ? best->pkg->name : "", best ? (int)best->spriority : -1, trythis->name, trythis->clientdata->spriority); @@ -150,7 +150,7 @@ static int dep_update_best_to_change_stop(perpackagestate *& best, pkginfo *tryt return 0; yes: - if (depdebug && debug) fprintf(debug,"update_best_to_change(); yes\n"); + if (depdebug && debug) fprintf(debug,_("update_best_to_change(); yes\n")); best=trythis->clientdata; return 0; } @@ -168,7 +168,7 @@ int packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, dependency *display ed= ped->clientdata; if (depdebug && debug) - fprintf(debug,"packagelist[%p]::deselect_one_of(): er %s{%d} ed %s{%d} [%p]\n", + fprintf(debug,_("packagelist[%p]::deselect_one_of(): er %s{%d} ed %s{%d} [%p]\n"), this, er->pkg->name, er->spriority, ed->pkg->name, ed->spriority, display); perpackagestate *best; @@ -185,7 +185,7 @@ int packagelist::deselect_one_of(pkginfo *per, pkginfo *ped, dependency *display else best= ed; // ... failing that, the second if (depdebug && debug) - fprintf(debug,"packagelist[%p]::deselect_one_of(): best %s{%d}\n", + fprintf(debug,_("packagelist[%p]::deselect_one_of(): best %s{%d}\n"), this, best->pkg->name, best->spriority); if (best->spriority >= sp_deselecting) return 0; @@ -204,14 +204,14 @@ int packagelist::resolvedepcon(dependency *depends) { int r, foundany; if (depdebug && debug) { - fprintf(debug,"packagelist[%p]::resolvedepcon([%p] %s --%s-->", - this,depends,depends->up->name,relatestrings[depends->type]); + fprintf(debug,_("packagelist[%p]::resolvedepcon([%p] %s --%s-->"), + this,depends,depends->up->name,gettext(relatestrings[depends->type])); for (possi=depends->list; possi; possi=possi->next) fprintf(debug," %s",possi->ed->name); fprintf(debug,"); (ing)->want=%s\n", depends->up->clientdata - ? wantstrings[depends->up->clientdata->suggested] - : "(no clientdata)"); + ? gettext(wantstrings[depends->up->clientdata->suggested]) + : _("(no clientdata)")); } if (!depends->up->clientdata) return 0; @@ -238,9 +238,9 @@ int packagelist::resolvedepcon(dependency *depends) { possi && !deppossatisfied(possi,&fixbyupgrade); possi= possi->next); if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): depends found %s\n", + fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): depends found %s\n"), this,depends, - possi ? possi->ed->name : "[none]"); + possi ? possi->ed->name : _("[none]")); if (possi) return 0; // Ensures all in the recursive list; adds info strings; ups priorities @@ -249,8 +249,8 @@ int packagelist::resolvedepcon(dependency *depends) { if (depends->type == dep_suggests) return r; if (fixbyupgrade) { - if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): " - "fixbyupgrade %s\n", this,depends,fixbyupgrade->pkg->name); + if (depdebug && debug) fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): " + "fixbyupgrade %s\n"), this,depends,fixbyupgrade->pkg->name); best= fixbyupgrade; } else { best= 0; @@ -270,13 +270,13 @@ int packagelist::resolvedepcon(dependency *depends) { if (!foundany) addunavailable(possi); } if (!best) { - if (depdebug && debug) fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): " - "mustdeselect nobest\n", this,depends); + if (depdebug && debug) fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): " + "mustdeselect nobest\n"), this,depends); return r; } } if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): select best=%s{%d}\n", + fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): select best=%s{%d}\n"), this,depends, best->pkg->name, best->spriority); if (best->spriority >= sp_selecting) return r; best->selected= best->suggested= pkginfo::want_install; @@ -286,7 +286,7 @@ int packagelist::resolvedepcon(dependency *depends) { mustdeselect: best= depends->up->clientdata; if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): mustdeselect best=%s{%d}\n", + fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): mustdeselect best=%s{%d}\n"), this,depends, best->pkg->name, best->spriority); if (best->spriority >= sp_deselecting) return r; @@ -299,20 +299,20 @@ int packagelist::resolvedepcon(dependency *depends) { case dep_conflicts: if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): conflict\n", + fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): conflict\n"), this,depends); if (would_like_to_install(depends->up->clientdata->selected,depends->up) == 0) return 0; if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): conflict installing 1\n", + fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): conflict installing 1\n"), this,depends); if (!deppossatisfied(depends->list,0)) return 0; if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): conflict satisfied - ouch\n", + fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): conflict satisfied - ouch\n"), this,depends); if (depends->up != depends->list->ed) { @@ -327,11 +327,11 @@ int packagelist::resolvedepcon(dependency *depends) { r= deselect_one_of(depends->up, provider->up->up, depends); if (r) return r; } if (depdebug && debug) - fprintf(debug,"packagelist[%p]::resolvedepcon([%p]): no desel\n", this,depends); + fprintf(debug,_("packagelist[%p]::resolvedepcon([%p]): no desel\n"), this,depends); return 0; default: - internerr("unknown deptype"); + internerr(_("unknown deptype")); } /* never reached, make gcc happy */ return 1; diff --git a/dselect/pkgdisplay.cc b/dselect/pkgdisplay.cc index 16a4ff286..82ac23623 100644 --- a/dselect/pkgdisplay.cc +++ b/dselect/pkgdisplay.cc @@ -35,54 +35,90 @@ extern "C" { /* These MUST be in the same order as the corresponding enums in dpkg-db.h */ const char - *const wantstrings[]= { "new package", "install", "hold", "remove", "purge", 0 }, - *const eflagstrings[]= { "", "REINSTALL", 0 }, - *const statusstrings[]= { "not installed", "unpacked (not set up)", - "failed config", "installed", "half installed", - "removed (configs remain)", 0 }, - *const prioritystrings[]= { "Required", "Important", "Standard", "Recommended", - "Optional", "Extra", "Contrib", - "!Bug!", "Unclassified", 0 }, - *const relatestrings[]= { "suggests", "recommends", "depends on", "pre-depends on", - "conflicts with", "provides", "replaces", 0 }, - *const priorityabbrevs[]= { "Req", "Imp", "Std", "Rec", - "Opt", "Xtr", "Ctb", - "bUG", "?" }; + *const wantstrings[]= { N_("new package"), + N_("install"), + N_("hold"), + N_("remove"), + N_("purge"), + 0 }, + + *const eflagstrings[]= { N_(""), + N_("REINSTALL"), + 0 }, + + *const statusstrings[]= { N_("not installed"), + N_("unpacked (not set up)"), + N_("failed config"), + N_("installed"), + N_("half installed"), + N_("removed (configs remain)"), + 0 }, + + *const prioritystrings[]= { N_("Required"), + N_("Important"), + N_("Standard"), + N_("Recommended"), + N_("Optional"), + N_("Extra"), + N_("Contrib"), + N_("!Bug!"), + N_("Unclassified"), + 0 }, + + *const relatestrings[]= { N_("suggests"), + N_("recommends"), + N_("depends on"), + N_("pre-depends on"), + N_("conflicts with"), + N_("provides"), + N_("replaces"), + 0 }, + + *const priorityabbrevs[]= { N_("Req"), + N_("Imp"), + N_("Std"), + N_("Rec"), + N_("Opt"), + N_("Xtr"), + N_("Ctb"), + N_("bUG"), + N_("?") }; + const char statuschars[]= " UC*I-"; const char eflagchars[]= " R?#"; const char wantchars[]= "n*=-_"; /* These MUST be in the same order as the corresponding enums in pkglist.h */ const char - *const ssaabbrevs[]= { "Broken", - "New", - "Updated", - "Obsolete/local", - "Up-to-date", - "Available", - "Removed" }, - *const ssastrings[]= { "Brokenly installed packages", - "Newly available packages", - "Updated packages (newer version is available)", - "Obsolete and local packages present on system", - "Up to date installed packages", - "Available packages (not currently installed)", - "Removed and no longer available packages" }; + *const ssaabbrevs[]= { N_("Broken"), + N_("New"), + N_("Updated"), + N_("Obsolete/local"), + N_("Up-to-date"), + N_("Available"), + N_("Removed") }, + *const ssastrings[]= { N_("Brokenly installed packages"), + N_("Newly available packages"), + N_("Updated packages (newer version is available)"), + N_("Obsolete and local packages present on system"), + N_("Up to date installed packages"), + N_("Available packages (not currently installed)"), + N_("Removed and no longer available packages") }; const char - *const sssstrings[]= { "Brokenly installed packages", - "Installed packages", - "Removed packages (configuration still present)", - "Purged packages and those never installed" }, - *const sssabbrevs[]= { "Broken", - "Installed", - "Removed", - "Purged" }; + *const sssstrings[]= { N_("Brokenly installed packages"), + N_("Installed packages"), + N_("Removed packages (configuration still present)"), + N_("Purged packages and those never installed") }, + *const sssabbrevs[]= { N_("Broken"), + N_("Installed"), + N_("Removed"), + N_("Purged") }; static int maximumstring(const char *const *array) { int maxlen= 0; while (*array) { - int l= strlen(*array); + int l= strlen(gettext(*array)); const char *p= strchr(*array, '('); if (p && p > *array && *--p == ' ') l= p - *array; if (l > maxlen) maxlen= l; @@ -92,7 +128,7 @@ static int maximumstring(const char *const *array) { } void packagelist::setwidths() { - if (debug) fprintf(debug,"packagelist[%p]::setwidths()\n",this); + if (debug) fprintf(debug,_("packagelist[%p]::setwidths()\n"),this); if (verbose) { status_hold_width= 9; @@ -142,7 +178,7 @@ void packagelist::setwidths() { description_column= versionavailable_column + versionavailable_width + gap_width; break; default: - internerr("unknown versiondisplayopt in setwidths"); + internerr(_("unknown versiondisplayopt in setwidths")); } total_width= TOTAL_LIST_WIDTH; @@ -155,9 +191,9 @@ void packagelist::redrawtitle() { if (title_height) { mywerase(titlewin); mvwaddnstr(titlewin,0,0, - recursive ? "dselect - recursive package listing" : - !readwrite ? "dselect - inspection of package states" : - "dselect - main package listing", + recursive ? _("dselect - recursive package listing") : + !readwrite ? _("dselect - inspection of package states") : + _("dselect - main package listing"), xmax); getyx(titlewin,y,x); if (x < xmax) { @@ -165,60 +201,60 @@ void packagelist::redrawtitle() { case so_section: switch (statsortorder) { case sso_unsorted: - waddnstr(titlewin, " (by section)", xmax-x); + waddnstr(titlewin, _(" (by section)"), xmax-x); break; case sso_avail: - waddnstr(titlewin, " (avail., section)", xmax-x); + waddnstr(titlewin, _(" (avail., section)"), xmax-x); break; case sso_state: - waddnstr(titlewin, " (status, section)", xmax-x); + waddnstr(titlewin, _(" (status, section)"), xmax-x); break; default: - internerr("bad statsort in redrawtitle/so_section"); + internerr(_("bad statsort in redrawtitle/so_section")); } break; case so_priority: switch (statsortorder) { case sso_unsorted: - waddnstr(titlewin, " (by priority)", xmax-x); + waddnstr(titlewin, _(" (by priority)"), xmax-x); break; case sso_avail: - waddnstr(titlewin, " (avail., priority)", xmax-x); + waddnstr(titlewin, _(" (avail., priority)"), xmax-x); break; case sso_state: - waddnstr(titlewin, " (status, priority)", xmax-x); + waddnstr(titlewin, _(" (status, priority)"), xmax-x); break; default: - internerr("bad statsort in redrawtitle/so_priority"); + internerr(_("bad statsort in redrawtitle/so_priority")); } break; case so_alpha: switch (statsortorder) { case sso_unsorted: - waddnstr(titlewin, " (alphabetically)", xmax-x); + waddnstr(titlewin, _(" (alphabetically)"), xmax-x); break; case sso_avail: - waddnstr(titlewin, " (by availability)", xmax-x); + waddnstr(titlewin, _(" (by availability)"), xmax-x); break; case sso_state: - waddnstr(titlewin, " (by status)", xmax-x); + waddnstr(titlewin, _(" (by status)"), xmax-x); break; default: - internerr("bad statsort in redrawtitle/so_priority"); + internerr(_("bad statsort in redrawtitle/so_priority")); } break; - waddnstr(titlewin, " (alphabetically)", xmax-x); + waddnstr(titlewin, _(" (alphabetically)"), xmax-x); break; case so_unsorted: break; default: - internerr("bad sort in redrawtitle"); + internerr(_("bad sort in redrawtitle")); } } - const char *helpstring= readwrite ? (verbose ? " mark:+/=/- terse:v help:?" - : " mark:+/=/- verbose:v help:?") - : (verbose ? " terse:v help:?" - : " verbose:v help:?"); + const char *helpstring= readwrite ? (verbose ? _(" mark:+/=/- terse:v help:?") + : _(" mark:+/=/- verbose:v help:?")) + : (verbose ? _(" terse:v help:?") + : _(" verbose:v help:?")); int l= strlen(helpstring); getyx(titlewin,y,x); if (xmax-l > 0) { diff --git a/dselect/pkginfo.cc b/dselect/pkginfo.cc index 1428c580d..aa9ad06a7 100644 --- a/dselect/pkginfo.cc +++ b/dselect/pkginfo.cc @@ -78,7 +78,7 @@ const packagelist::infotype *const packagelist::baseinfo= infoinfos; void packagelist::severalinfoblurb(const char *whatinfoline) { whatinfovb(whatinfoline); varbuf vb; - vb("The line you have highlighted represents many packages; " + vb(_("The line you have highlighted represents many packages; " "if you ask to install, remove, hold, &c it you will affect all " "the packages which match the criterion shown.\n" "\n" @@ -86,29 +86,29 @@ void packagelist::severalinfoblurb(const char *whatinfoline) { "you will see information about that package displayed here." "\n" "You can use `o' and `O' to change the sort order and give yourself " - "the opportunity to mark packages in different kinds of groups."); + "the opportunity to mark packages in different kinds of groups.")); wordwrapinfo(0,vb.string()); } void packagelist::itd_relations() { if (table[cursorline]->pkg->name) { - whatinfovb("interrelationships affecting "); + whatinfovb(_("interrelationships affecting ")); whatinfovb(table[cursorline]->pkg->name); - if (debug) fprintf(debug,"packagelist[%p]::idt_relations(); `%s'\n", + if (debug) fprintf(debug,_("packagelist[%p]::idt_relations(); `%s'\n"), this,table[cursorline]->relations.string()); waddstr(infopad,table[cursorline]->relations.string()); } else { - severalinfoblurb("interrelationships"); + severalinfoblurb(_("interrelationships")); } } void packagelist::itd_description() { if (table[cursorline]->pkg->name) { - whatinfovb("description of "); + whatinfovb(_("description of ")); whatinfovb(table[cursorline]->pkg->name); const char *m= table[cursorline]->pkg->available.description; - if (!m || !*m) m= "no description available."; + if (!m || !*m) m= _("no description available."); const char *p= strchr(m,'\n'); int l= p ? (int)(p-m) : strlen(m); wattrset(infopad,info_headattr); @@ -121,22 +121,22 @@ void packagelist::itd_description() { wordwrapinfo(1,++p); } } else { - severalinfoblurb("description"); + severalinfoblurb(_("description")); } } void packagelist::itd_statuscontrol() { werase(infopad); if (!table[cursorline]->pkg->name) { - severalinfoblurb("currently installed control info"); + severalinfoblurb(_("currently installed control info")); } else { - whatinfovb("installed control info for "); + whatinfovb(_("installed control info for ")); whatinfovb(table[cursorline]->pkg->name); varbuf vb; varbufrecord(&vb,table[cursorline]->pkg,&table[cursorline]->pkg->installed); vb.terminate(); if (debug) - fprintf(debug,"packagelist[%p]::idt_statuscontrol(); `%s'\n",this,vb.string()); + fprintf(debug,_("packagelist[%p]::idt_statuscontrol(); `%s'\n"),this,vb.string()); waddstr(infopad,vb.string()); } } @@ -144,15 +144,15 @@ void packagelist::itd_statuscontrol() { void packagelist::itd_availablecontrol() { werase(infopad); if (!table[cursorline]->pkg->name) { - severalinfoblurb("available version of control file info"); + severalinfoblurb(_("available version of control file info")); } else { - whatinfovb("available version of control info for "); + whatinfovb(_("available version of control info for ")); whatinfovb(table[cursorline]->pkg->name); varbuf vb; varbufrecord(&vb,table[cursorline]->pkg,&table[cursorline]->pkg->available); vb.terminate(); if (debug) - fprintf(debug,"packagelist[%p]::idt_availablecontrol(); `%s'\n",this,vb.string()); + fprintf(debug,_("packagelist[%p]::idt_availablecontrol(); `%s'\n"),this,vb.string()); waddstr(infopad,vb.string()); } } @@ -169,7 +169,7 @@ void packagelist::redrawinfo() { werase(infopad); wmove(infopad,0,0); if (debug) - fprintf(debug,"packagelist[%p]::redrawinfo(); #=%d\n", this, + fprintf(debug,_("packagelist[%p]::redrawinfo(); #=%d\n"), this, (int)(currentinfo - baseinfo)); (this->*currentinfo->display)(); diff --git a/dselect/pkglist.cc b/dselect/pkglist.cc index a3987adce..829a21ddd 100644 --- a/dselect/pkglist.cc +++ b/dselect/pkglist.cc @@ -45,7 +45,7 @@ int packagelist::compareentries(struct perpackagestate *a, case sso_unsorted: break; default: - internerr("unknown statsortorder in compareentries"); + internerr(_("unknown statsortorder in compareentries")); } const char *asection= a->pkg->section; @@ -76,7 +76,7 @@ int packagelist::compareentries(struct perpackagestate *a, return c_name; case so_unsorted: default: - internerr("unsorted or unknown in compareentries"); + internerr(_("unsorted or unknown in compareentries")); } /* never reached, make gcc happy */ return 1; @@ -116,10 +116,10 @@ void packagelist::addheading(enum ssavailval ssavail, table= newtable; } - if (debug) fprintf(debug,"packagelist[%p]::addheading(%d,%d,%d,%s,%s)\n", + if (debug) fprintf(debug,_("packagelist[%p]::addheading(%d,%d,%d,%s,%s)\n"), this,ssavail,ssstate,priority, - otherpriority ? otherpriority : "<null>", - section ? section : "<null>"); + otherpriority ? otherpriority : _("<null>"), + section ? section : _("<null>")); struct pkginfo *newhead= new pkginfo; newhead->name= 0; @@ -148,7 +148,7 @@ int qsort_compareentries(const void *a, const void *b) { void packagelist::sortinplace() { sortpackagelist= this; - if (debug) fprintf(debug,"packagelist[%p]::sortinplace()\n",this); + if (debug) fprintf(debug,_("packagelist[%p]::sortinplace()\n"),this); qsort(table,nitems,sizeof(struct pkginfoperfile*),qsort_compareentries); } @@ -158,20 +158,20 @@ void packagelist::ensurestatsortinfo() { struct pkginfo *pkg; int index; - if (debug) fprintf(debug,"packagelist[%p]::ensurestatsortinfos() " - "sortorder=%d nitems=%d\n",this,statsortorder,nitems); + if (debug) fprintf(debug,_("packagelist[%p]::ensurestatsortinfos() " + "sortorder=%d nitems=%d\n"),this,statsortorder,nitems); switch (statsortorder) { case sso_unsorted: - if (debug) fprintf(debug,"packagelist[%p]::ensurestatsortinfos() unsorted\n",this); + if (debug) fprintf(debug,_("packagelist[%p]::ensurestatsortinfos() unsorted\n"),this); return; case sso_avail: - if (debug) fprintf(debug,"packagelist[%p]::ensurestatsortinfos() calcssadone=%d\n", + if (debug) fprintf(debug,_("packagelist[%p]::ensurestatsortinfos() calcssadone=%d\n"), this,calcssadone); if (calcssadone) return; for (index=0; index < nitems; index++) { if (debug) - fprintf(debug,"packagelist[%p]::ensurestatsortinfos() i=%d pkg=%s\n", + fprintf(debug,_("packagelist[%p]::ensurestatsortinfos() i=%d pkg=%s\n"), this,index,table[index]->pkg->name); pkg= table[index]->pkg; if (!pkg->installed.valid) blankpackageperfile(&pkg->installed); @@ -204,22 +204,22 @@ void packagelist::ensurestatsortinfo() { } break; default: - internerr("unknown stat in ensurestatsortinfo sso_avail"); + internerr(_("unknown stat in ensurestatsortinfo sso_avail")); } if (debug) - fprintf(debug,"packagelist[%p]::ensurestatsortinfos() i=%d ssavail=%d\n", + fprintf(debug,_("packagelist[%p]::ensurestatsortinfos() i=%d ssavail=%d\n"), this,index,table[index]->ssavail); } calcssadone= 1; break; case sso_state: - if (debug) fprintf(debug,"packagelist[%p]::ensurestatsortinfos() calcsssdone=%d\n", + if (debug) fprintf(debug,_(_("packagelist[%p]::ensurestatsortinfos() calcsssdone=%d\n")), this,calcsssdone); if (calcsssdone) return; for (index=0; index < nitems; index++) { if (debug) - fprintf(debug,"packagelist[%p]::ensurestatsortinfos() i=%d pkg=%s\n", + fprintf(debug,_("packagelist[%p]::ensurestatsortinfos() i=%d pkg=%s\n"), this,index,table[index]->pkg->name); switch (table[index]->pkg->status) { case pkginfo::stat_unpacked: @@ -237,17 +237,17 @@ void packagelist::ensurestatsortinfo() { table[index]->ssstate= sss_installed; break; default: - internerr("unknown stat in ensurestatsortinfo sso_state"); + internerr(_("unknown stat in ensurestatsortinfo sso_state")); } if (debug) - fprintf(debug,"packagelist[%p]::ensurestatsortinfos() i=%d ssstate=%d\n", + fprintf(debug,_("packagelist[%p]::ensurestatsortinfos() i=%d ssstate=%d\n"), this,index,table[index]->ssstate); } calcsssdone= 1; break; default: - internerr("unknown statsortorder in ensurestatsortinfo"); + internerr(_("unknown statsortorder in ensurestatsortinfo")); } } diff --git a/dselect/pkgsublist.cc b/dselect/pkgsublist.cc index 1c301f62f..b9b9db826 100644 --- a/dselect/pkgsublist.cc +++ b/dselect/pkgsublist.cc @@ -34,12 +34,12 @@ extern "C" { #include "bindings.h" void packagelist::add(pkginfo *pkg) { - if (debug) fprintf(debug,"packagelist[%p]::add(pkginfo %s)\n",this,pkg->name); + if (debug) fprintf(debug,_("packagelist[%p]::add(pkginfo %s)\n"),this,pkg->name); if (!recursive || // never add things to top level !pkg->clientdata || // don't add pure virtual packages pkg->clientdata->uprec) // don't add ones already in the recursive list return; - if (debug) fprintf(debug,"packagelist[%p]::add(pkginfo %s) adding\n",this,pkg->name); + if (debug) fprintf(debug,_("packagelist[%p]::add(pkginfo %s) adding\n"),this,pkg->name); perpackagestate *state= &datatable[nitems]; state->pkg= pkg; state->direct= state->original= pkg->clientdata->selected; @@ -53,15 +53,15 @@ void packagelist::add(pkginfo *pkg) { } void packagelist::add(pkginfo *pkg, pkginfo::pkgwant nw) { - if (debug) fprintf(debug,"packagelist[%p]::add(pkginfo %s, %s)\n", - this,pkg->name,wantstrings[nw]); + if (debug) fprintf(debug,_("packagelist[%p]::add(pkginfo %s, %s)\n"), + this,pkg->name,gettext(wantstrings[nw])); add(pkg); if (!pkg->clientdata) return; pkg->clientdata->direct= nw; selpriority np; np= would_like_to_install(nw,pkg) ? sp_selecting : sp_deselecting; if (pkg->clientdata->spriority > np) return; - if (debug) fprintf(debug,"packagelist[%p]::add(pkginfo %s, %s) setting\n", - this,pkg->name,wantstrings[nw]); + if (debug) fprintf(debug,_("packagelist[%p]::add(pkginfo %s, %s) setting\n"), + this,pkg->name,gettext(wantstrings[nw])); pkg->clientdata->suggested= pkg->clientdata->selected= nw; pkg->clientdata->spriority= np; @@ -69,7 +69,7 @@ void packagelist::add(pkginfo *pkg, pkginfo::pkgwant nw) { void packagelist::add(pkginfo *pkg, const char *extrainfo, showpriority showimp) { if (debug) - fprintf(debug,"packagelist[%p]::add(pkginfo %s, \"...\", showpriority %d)\n", + fprintf(debug,_("packagelist[%p]::add(pkginfo %s, \"...\", showpriority %d)\n"), this,pkg->name,showimp); add(pkg); if (!pkg->clientdata) return; if (pkg->clientdata->dpriority < showimp) pkg->clientdata->dpriority= showimp; @@ -82,7 +82,7 @@ int packagelist::alreadydone(doneent **done, void *check) { for (search= *done; search && search->dep != check; search=search->next); if (search) return 1; - if (debug) fprintf(debug,"packagelist[%p]::alreadydone(%p,%p) new\n", + if (debug) fprintf(debug,_("packagelist[%p]::alreadydone(%p,%p) new\n"), this,done,check); search= new doneent; search->next= *done; @@ -92,7 +92,7 @@ int packagelist::alreadydone(doneent **done, void *check) { } void packagelist::addunavailable(deppossi *possi) { - if (debug) fprintf(debug,"packagelist[%p]::addunavail(%p)\n",this,possi); + if (debug) fprintf(debug,_("packagelist[%p]::addunavail(%p)\n"),this,possi); if (!recursive) return; if (alreadydone(&unavdone,possi)) return; @@ -106,7 +106,7 @@ void packagelist::addunavailable(deppossi *possi) { } int packagelist::add(dependency *depends, showpriority displayimportance) { - if (debug) fprintf(debug,"packagelist[%p]::add(dependency[%p])\n",this,depends); + if (debug) fprintf(debug,_("packagelist[%p]::add(dependency[%p])\n"),this,depends); if (alreadydone(&depsdone,depends)) return 0; @@ -114,7 +114,7 @@ int packagelist::add(dependency *depends, showpriority displayimportance) { varbuf info; info(depends->up->name); info(' '); - info(relatestrings[depends->type]); + info(gettext(relatestrings[depends->type])); info(' '); deppossi *possi; for (possi=depends->list; @@ -129,7 +129,7 @@ int packagelist::add(dependency *depends, showpriority displayimportance) { case dvr_earlierstrict: info(" (<< "); break; case dvr_laterstrict: info(" (>> "); break; case dvr_exact: info(" (= "); break; - default: internerr("unknown verrel"); + default: internerr(_("unknown verrel")); } info(versiondescribe(&possi->version,vdew_never)); info(")"); @@ -161,29 +161,29 @@ void repeatedlydisplay(packagelist *sub, pkginfo **newl; keybindings *kb; - if (debug) fprintf(debug,"repeatedlydisplay(packagelist[%p])\n",sub); + if (debug) fprintf(debug,_("repeatedlydisplay(packagelist[%p])\n"),sub); if (sub->resolvesuggest() != 0 && sub->deletelessimp_anyleft(initial)) { - if (debug) fprintf(debug,"repeatedlydisplay(packagelist[%p]) once\n",sub); + if (debug) fprintf(debug,_("repeatedlydisplay(packagelist[%p]) once\n"),sub); if (unredisplay) unredisplay->enddisplay(); for (;;) { newl= sub->display(); if (!newl) break; - if (debug) fprintf(debug,"repeatedlydisplay(packagelist[%p]) newl\n",sub); + if (debug) fprintf(debug,_("repeatedlydisplay(packagelist[%p]) newl\n"),sub); kb= sub->bindings; delete sub; sub= new packagelist(kb,newl); if (sub->resolvesuggest() <= 1) break; if (!sub->deletelessimp_anyleft(dp_must)) break; - if (debug) fprintf(debug,"repeatedlydisplay(packagelist[%p]) again\n",sub); + if (debug) fprintf(debug,_("repeatedlydisplay(packagelist[%p]) again\n"),sub); } if (unredisplay) unredisplay->startdisplay(); } delete sub; - if (debug) fprintf(debug,"repeatedlydisplay(packagelist[%p]) done\n",sub); + if (debug) fprintf(debug,_("repeatedlydisplay(packagelist[%p]) done\n"),sub); } int packagelist::deletelessimp_anyleft(showpriority than) { if (debug) - fprintf(debug,"packagelist[%p]::dli_al(%d): nitems=%d\n",this,than,nitems); + fprintf(debug,_("packagelist[%p]::dli_al(%d): nitems=%d\n"),this,than,nitems); int insat, runthr; for (runthr=0, insat=0; runthr < nitems; @@ -196,7 +196,7 @@ int packagelist::deletelessimp_anyleft(showpriority than) { } } nitems= insat; - if (debug) fprintf(debug,"packagelist[%p]::dli_al(%d) done; nitems=%d\n", + if (debug) fprintf(debug,_("packagelist[%p]::dli_al(%d) done; nitems=%d\n"), this,than,nitems); return nitems; } diff --git a/dselect/pkgtop.cc b/dselect/pkgtop.cc index 80577786d..ba6095054 100644 --- a/dselect/pkgtop.cc +++ b/dselect/pkgtop.cc @@ -41,7 +41,7 @@ const char *pkgprioritystring(const struct pkginfo *pkg) { return pkg->otherpriority; } else { assert(pkg->priority <= pkginfo::pri_unknown); - return prioritystrings[pkg->priority]; + return gettext(prioritystrings[pkg->priority]); } } @@ -53,7 +53,7 @@ int packagelist::describemany(char buf[], const char *prioritystring, statindent= 0; ssostring= 0; - ssoabbrev= "All"; + ssoabbrev= _("All"); switch (statsortorder) { case sso_avail: if (pps->ssavail == -1) break; @@ -70,30 +70,30 @@ int packagelist::describemany(char buf[], const char *prioritystring, case sso_unsorted: break; default: - internerr("unknown statsortrder in describemany all"); + internerr(_("unknown statsortrder in describemany all")); } if (!prioritystring) { if (!section) { - strcpy(buf, ssostring ? ssostring : "All packages"); + strcpy(buf, ssostring ? gettext(ssostring) : _("All packages")); return statindent; } else { if (!*section) { - sprintf(buf,"%s packages without a section",ssoabbrev); + sprintf(buf,_("%s packages without a section"),gettext(ssoabbrev)); } else { - sprintf(buf,"%s packages in section %s",ssoabbrev,section); + sprintf(buf,_("%s packages in section %s"),gettext(ssoabbrev),section); } return statindent+1; } } else { if (!section) { - sprintf(buf,"%s %s packages",ssoabbrev,prioritystring); + sprintf(buf,_("%s %s packages"),gettext(ssoabbrev),prioritystring); return statindent+1; } else { if (!*section) { - sprintf(buf,"%s %s packages without a section",ssoabbrev,prioritystring); + sprintf(buf,_("%s %s packages without a section"),gettext(ssoabbrev),prioritystring); } else { - sprintf(buf,"%s %s packages in section %s",ssoabbrev,prioritystring,section); + sprintf(buf,_("%s %s packages in section %s"),gettext(ssoabbrev),prioritystring,section); } return statindent+2; } @@ -114,14 +114,14 @@ void packagelist::redrawthisstate() { if (table[cursorline]->pkg->name) { sprintf(buf, - "%-*s %s%s%s; %s (was: %s). %s", + _("%-*s %s%s%s; %s (was: %s). %s"), package_width, table[cursorline]->pkg->name, - statusstrings[table[cursorline]->pkg->status], + gettext(statusstrings[table[cursorline]->pkg->status]), eflagstrings[table[cursorline]->pkg->eflag][0] ? " - " : "", - eflagstrings[table[cursorline]->pkg->eflag], - wantstrings[table[cursorline]->selected], - wantstrings[table[cursorline]->original], + gettext(eflagstrings[table[cursorline]->pkg->eflag]), + gettext(wantstrings[table[cursorline]->selected]), + gettext(wantstrings[table[cursorline]->original]), priority); } else { describemany(buf,priority,section,table[cursorline]->pkg->clientdata); @@ -147,26 +147,26 @@ void packagelist::redraw1itemsel(int index, int selected) { mvwprintw(listpad,index,0, "%-*.*s ", status_hold_width, status_hold_width, - eflagstrings[pkg->eflag]); + gettext(eflagstrings[pkg->eflag])); wprintw(listpad, "%-*.*s ", status_status_width, status_status_width, - statusstrings[pkg->status]); + gettext(statusstrings[pkg->status])); wprintw(listpad, "%-*.*s ", status_want_width, status_want_width, /* fixme: keep this ? */ /*table[index]->original == table[index]->selected ? "(same)" - : */wantstrings[table[index]->original]); + : */gettext(wantstrings[table[index]->original])); wattrset(listpad, selected ? selstatesel_attr : selstate_attr); wprintw(listpad, "%-*.*s", status_want_width, status_want_width, - wantstrings[table[index]->selected]); + gettext(wantstrings[table[index]->selected])); wattrset(listpad, selected ? listsel_attr : list_attr); waddch(listpad, ' '); mvwprintw(listpad,index,priority_column-1, " %-*.*s", priority_width, priority_width, pkg->priority == pkginfo::pri_other ? pkg->otherpriority : - prioritystrings[pkg->priority]); + gettext(prioritystrings[pkg->priority])); } else { @@ -192,7 +192,7 @@ void packagelist::redraw1itemsel(int index, int selected) { while (i-- > 0) waddch(listpad,' '); } else { wprintw(listpad, "%-*.*s", priority_width, priority_width, - priorityabbrevs[pkg->priority]); + gettext(priorityabbrevs[pkg->priority])); } } @@ -265,26 +265,26 @@ void packagelist::redrawcolheads() { for (int i=0; i<status_width-status_want_width; i++) waddch(colheadspad,'.'); mvwaddnstr(colheadspad,0, 0, - "Error", + _("Error"), status_hold_width); mvwaddnstr(colheadspad,0, status_hold_width+1, - "Installed?", + _("Installed?"), status_status_width); mvwaddnstr(colheadspad,0, status_hold_width+status_status_width+2, - "Old mark", + _("Old mark"), status_want_width); mvwaddnstr(colheadspad,0, status_hold_width+status_status_width+status_want_width+3, - "Marked for", + _("Marked for"), status_want_width); } else { mvwaddstr(colheadspad,0,0, "EIOM"); } - mvwaddnstr(colheadspad,0,section_column, "Section", section_width); - mvwaddnstr(colheadspad,0,priority_column, "Priority", priority_width); - mvwaddnstr(colheadspad,0,package_column, "Package", package_width); + mvwaddnstr(colheadspad,0,section_column, _("Section"), section_width); + mvwaddnstr(colheadspad,0,priority_column, _("Priority"), priority_width); + mvwaddnstr(colheadspad,0,package_column, _("Package"), package_width); if (versioninstalled_width) mvwaddnstr(colheadspad,0,versioninstalled_column, @@ -293,7 +293,7 @@ void packagelist::redrawcolheads() { mvwaddnstr(colheadspad,0,versionavailable_column, "Avail.ver",versionavailable_width); - mvwaddnstr(colheadspad,0,description_column, "Description", description_width); + mvwaddnstr(colheadspad,0,description_column, _("Description"), description_width); } refreshcolheads(); } |