Translate help / usage strings.

This commit is contained in:
Todd C. Miller
2011-05-19 16:07:14 -04:00
parent d2384297a0
commit 67cc4ff025
6 changed files with 107 additions and 84 deletions

View File

@@ -1546,7 +1546,10 @@ sudo_ldap_display_entry_long(LDAP *ld, LDAPMessage *entry, struct lbuf *lbuf)
/* extract the dn, only show the first rdn */
rdn = sudo_ldap_get_first_rdn(ld, entry);
lbuf_append(lbuf, "\nLDAP Role: ", rdn ? rdn : "UNKNOWN", "\n", NULL);
if (rdn != NULL)
lbuf_append(lbuf, _("\nLDAP Role: "), rdn, "\n", NULL);
else
lbuf_append(lbuf, _("\nLDAP Role: UNKNOWN\n"), NULL);
if (rdn)
ldap_memfree(rdn);

View File

@@ -371,9 +371,9 @@ sudo_file_display_priv_long(struct passwd *pw, struct userspec *us,
tags.nopasswd = UNSPEC;
tags.log_input = UNSPEC;
tags.log_output = UNSPEC;
lbuf_append(lbuf, "\nSudoers entry:\n", NULL);
lbuf_append(lbuf, _("\nSudoers entry:\n"), NULL);
tq_foreach_fwd(&priv->cmndlist, cs) {
lbuf_append(lbuf, " RunAsUsers: ", NULL);
lbuf_append(lbuf, " ", _("RunAsUsers: "), NULL);
if (!tq_empty(&cs->runasuserlist)) {
tq_foreach_fwd(&cs->runasuserlist, m) {
if (m != tq_first(&cs->runasuserlist))
@@ -388,7 +388,7 @@ sudo_file_display_priv_long(struct passwd *pw, struct userspec *us,
}
lbuf_append(lbuf, "\n", NULL);
if (!tq_empty(&cs->runasgrouplist)) {
lbuf_append(lbuf, " RunAsGroups: ", NULL);
lbuf_append(lbuf, " ", _("RunAsGroups: "), NULL);
tq_foreach_fwd(&cs->runasgrouplist, m) {
if (m != tq_first(&cs->runasgrouplist))
lbuf_append(lbuf, ", ", NULL);
@@ -397,7 +397,7 @@ sudo_file_display_priv_long(struct passwd *pw, struct userspec *us,
}
lbuf_append(lbuf, "\n", NULL);
}
lbuf_append(lbuf, " Commands:\n\t", NULL);
lbuf_append(lbuf, " ", _("Commands:\n\t"), NULL);
sudo_file_append_cmnd(cs, &tags, lbuf);
lbuf_append(lbuf, "\n", NULL);
nfound++;

View File

@@ -263,8 +263,8 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
lbuf_init(&privs, output, 4, NULL, sudo_user.cols);
/* Display defaults from all sources. */
lbuf_append(&defs, "Matching Defaults entries for ", pw->pw_name,
" on this host:\n", NULL);
lbuf_append(&defs, _("Matching Defaults entries for "), pw->pw_name,
_(" on this host:\n"), NULL);
count = 0;
tq_foreach_fwd(snl, nss) {
count += nss->display_defaults(nss, pw, &defs);
@@ -276,8 +276,8 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
/* Display Runas and Cmnd-specific defaults from all sources. */
olen = defs.len;
lbuf_append(&defs, "Runas and Command-specific defaults for ", pw->pw_name,
":\n", NULL);
lbuf_append(&defs, _("Runas and Command-specific defaults for "),
pw->pw_name, ":\n", NULL);
count = 0;
tq_foreach_fwd(snl, nss) {
count += nss->display_bound_defaults(nss, pw, &defs);
@@ -288,8 +288,8 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
defs.len = olen;
/* Display privileges from all sources. */
lbuf_append(&privs, "User ", pw->pw_name,
" may run the following commands on this host:\n", NULL);
lbuf_append(&privs, _("User "), pw->pw_name,
_(" may run the following commands on this host:\n"), NULL);
count = 0;
tq_foreach_fwd(snl, nss) {
count += nss->display_privs(nss, pw, &privs);
@@ -298,7 +298,7 @@ display_privs(struct sudo_nss_list *snl, struct passwd *pw)
lbuf_print(&defs);
lbuf_print(&privs);
} else {
printf("User %s is not allowed to run sudo on %s.\n", pw->pw_name,
printf(_("User %s is not allowed to run sudo on %s.\n"), pw->pw_name,
user_shost);
}

View File

@@ -288,7 +288,7 @@ main(int argc, char *argv[])
errorx(1, _("invalid speed factor: %s"), optarg);
break;
case 'V':
(void) printf("%s version %s\n", getprogname(), PACKAGE_VERSION);
(void) printf(_("%s version %s\n"), getprogname(), PACKAGE_VERSION);
exit(0);
default:
usage(1);
@@ -345,7 +345,7 @@ main(int argc, char *argv[])
getline(&cp, &len, lfile) == -1) {
errorx(1, _("invalid log file %s"), path);
}
printf("Replaying sudo session: %s", cp);
printf(_("Replaying sudo session: %s"), cp);
free(cp);
fclose(lfile);
@@ -939,10 +939,10 @@ static void
usage(int fatal)
{
fprintf(fatal ? stderr : stdout,
"usage: %s [-h] [-d directory] [-m max_wait] [-s speed_factor] ID\n",
_("usage: %s [-h] [-d directory] [-m max_wait] [-s speed_factor] ID\n"),
getprogname());
fprintf(fatal ? stderr : stdout,
"usage: %s [-h] [-d directory] -l [search expression]\n",
_("usage: %s [-h] [-d directory] -l [search expression]\n"),
getprogname());
if (fatal)
exit(1);
@@ -951,16 +951,16 @@ usage(int fatal)
static void
help(void)
{
(void) printf("%s - replay sudo session logs\n\n", getprogname());
(void) printf(_("%s - replay sudo session logs\n\n"), getprogname());
usage(0);
(void) puts("\nOptions:");
(void) puts(" -d directory specify directory for session logs");
(void) puts(" -f filter specify which I/O type to display");
(void) puts(" -h display help message and exit");
(void) puts(" -l [expression] list available session IDs that match expression");
(void) puts(" -m max_wait max number of seconds to wait between events");
(void) puts(" -s speed_factor speed up or slow down output");
(void) puts(" -V display version information and exit");
(void) puts(_("\nOptions:\n"
" -d directory specify directory for session logs\n"
" -f filter specify which I/O type to display\n"
" -h display help message and exit\n"
" -l [expression] list available session IDs that match expression\n"
" -m max_wait max number of seconds to wait between events\n"
" -s speed_factor speed up or slow down output\n"
" -V display version information and exit"));
exit(0);
}

View File

@@ -176,8 +176,8 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv, "Vcf:sq")) != -1) {
switch (ch) {
case 'V':
(void) printf("%s version %s\n", getprogname(), PACKAGE_VERSION);
(void) printf("%s grammar version %d\n", getprogname(), SUDOERS_GRAMMAR_VERSION);
(void) printf(_("%s version %s\n"), getprogname(), PACKAGE_VERSION);
(void) printf(_("%s grammar version %d\n"), getprogname(), SUDOERS_GRAMMAR_VERSION);
exit(0);
case 'c':
checkonly++; /* check mode */
@@ -240,7 +240,7 @@ main(int argc, char *argv[])
if (!sp->doedit)
continue;
if (sp != tq_first(&sudoerslist)) {
printf("press return to edit %s: ", sp->path);
printf(_("press return to edit %s: "), sp->path);
while ((ch = getchar()) != EOF && ch != '\n')
continue;
}
@@ -472,7 +472,7 @@ reparse_sudoers(char *editor, char *args, int strict, int quiet)
/* If any new #include directives were added, edit them too. */
for (sp = last->next; sp != NULL; sp = sp->next) {
printf("press return to edit %s: ", sp->path);
printf(_("press return to edit %s: "), sp->path);
while ((ch = getchar()) != EOF && ch != '\n')
continue;
edit_sudoers(sp, editor, args, errorlineno);
@@ -619,7 +619,7 @@ whatnow(void)
int choice, c;
for (;;) {
(void) fputs("What now? ", stdout);
(void) fputs(_("What now? "), stdout);
choice = getchar();
for (c = choice; c != '\n' && c != EOF;)
c = getchar();
@@ -633,10 +633,10 @@ whatnow(void)
case 'Q':
return choice;
default:
(void) puts("Options are:");
(void) puts(" (e)dit sudoers file again");
(void) puts(" e(x)it without saving changes to sudoers file");
(void) puts(" (Q)uit and save changes to sudoers file (DANGER!)\n");
(void) puts(_("Options are:\n"
" (e)dit sudoers file again\n"
" e(x)it without saving changes to sudoers file\n"
" (Q)uit and save changes to sudoers file (DANGER!)\n"));
}
}
}
@@ -720,12 +720,12 @@ check_syntax(char *sudoers_path, int quiet, int strict)
if (!quiet) {
if (parse_error) {
if (errorlineno != -1)
(void) printf("parse error in %s near line %d\n", errorfile,
errorlineno);
(void) printf(_("parse error in %s near line %d\n"),
errorfile, errorlineno);
else
(void) printf("parse error in %s\n", errorfile);
(void) printf(_("parse error in %s\n"), errorfile);
} else {
(void) printf("%s: parsed OK\n", sudoers_path);
(void) printf(_("%s: parsed OK\n"), sudoers_path);
}
}
/* Check mode and owner in strict mode. */
@@ -738,14 +738,15 @@ check_syntax(char *sudoers_path, int quiet, int strict)
if (sb.st_uid != SUDOERS_UID || sb.st_gid != SUDOERS_GID) {
error = TRUE;
if (!quiet) {
fprintf(stderr, "%s: wrong owner (uid, gid) should be (%d, %d)\n",
fprintf(stderr,
_("%s: wrong owner (uid, gid) should be (%d, %d)\n"),
sudoers_path, SUDOERS_UID, SUDOERS_GID);
}
}
if ((sb.st_mode & 07777) != SUDOERS_MODE) {
error = TRUE;
if (!quiet) {
fprintf(stderr, "%s: bad permissions, should be mode 0%o\n",
fprintf(stderr, _("%s: bad permissions, should be mode 0%o\n"),
sudoers_path, SUDOERS_MODE);
}
}
@@ -1186,15 +1187,15 @@ usage(int fatal)
static void
help(void)
{
(void) printf("%s - safely edit the sudoers file\n\n", getprogname());
(void) printf(_("%s - safely edit the sudoers file\n\n"), getprogname());
usage(0);
(void) puts("\nOptions:");
(void) puts(" -c check-only mode");
(void) puts(" -f sudoers specify sudoers file location");
(void) puts(" -h display help message and exit");
(void) puts(" -q less verbose (quiet) syntax error messages");
(void) puts(" -s strict syntax checking");
(void) puts(" -V display version information and exit");
(void) puts(_("\nOptions:\n"
" -c check-only mode\n"
" -f sudoers specify sudoers file location\n"
" -h display help message and exit\n"
" -q less verbose (quiet) syntax error messages\n"
" -s strict syntax checking\n"
" -V display version information and exit"));
exit(0);
}

View File

@@ -512,81 +512,100 @@ help(void)
lbuf_init(&lbuf, usage_out, indent, NULL, user_details.ts_cols);
if (strcmp(pname, "sudoedit") == 0)
lbuf_append(&lbuf, pname, " - edit files as another user\n\n", NULL);
lbuf_append(&lbuf, pname, _(" - edit files as another user\n\n"), NULL);
else
lbuf_append(&lbuf, pname, " - execute a command as another user\n\n", NULL);
lbuf_append(&lbuf, pname, _(" - execute a command as another user\n\n"), NULL);
lbuf_print(&lbuf);
usage(0);
lbuf_append(&lbuf, "\nOptions:\n", NULL);
lbuf_append(&lbuf, _("\nOptions:\n"), NULL);
#ifdef HAVE_BSD_AUTH_H
lbuf_append(&lbuf,
" -A use helper program for password prompting\n", NULL);
" -A ",
_("use helper program for password prompting\n"), NULL);
#endif
lbuf_append(&lbuf,
" -a type use specified BSD authentication type\n", NULL);
" -a type ",
_("use specified BSD authentication type\n"), NULL);
lbuf_append(&lbuf,
" -b run command in the background\n", NULL);
" -b ",
_("run command in the background\n"), NULL);
lbuf_append(&lbuf,
" -C fd close all file descriptors >= fd\n", NULL);
" -C fd ",
_("close all file descriptors >= fd\n"), NULL);
#ifdef HAVE_LOGIN_CAP_H
lbuf_append(&lbuf,
" -c class run command with specified login class\n", NULL);
" -c class ",
_("run command with specified login class\n"), NULL);
#endif
lbuf_append(&lbuf,
" -E preserve user environment when executing command\n",
NULL);
" -E ",
_("preserve user environment when executing command\n"), NULL);
lbuf_append(&lbuf,
" -e edit files instead of running a command\n", NULL);
" -e ",
_("edit files instead of running a command\n"), NULL);
lbuf_append(&lbuf,
" -g group execute command as the specified group\n", NULL);
" -g group ",
_("execute command as the specified group\n"), NULL);
lbuf_append(&lbuf,
" -H set HOME variable to target user's home dir.\n",
NULL);
" -H ",
_("set HOME variable to target user's home dir.\n"), NULL);
lbuf_append(&lbuf,
" -h display help message and exit\n", NULL);
" -h ",
_("display help message and exit\n"), NULL);
lbuf_append(&lbuf,
" -i [command] run a login shell as target user\n", NULL);
" -i [command] ",
_("run a login shell as target user\n"), NULL);
lbuf_append(&lbuf,
" -K remove timestamp file completely\n", NULL);
" -K ",
_("remove timestamp file completely\n"), NULL);
lbuf_append(&lbuf,
" -k invalidate timestamp file\n", NULL);
" -k ",
_("invalidate timestamp file\n"), NULL);
lbuf_append(&lbuf,
" -l[l] command list user's available commands\n", NULL);
" -l[l] command ",
_("list user's available commands\n"), NULL);
lbuf_append(&lbuf,
" -n non-interactive mode, will not prompt user\n", NULL);
" -n ",
_("non-interactive mode, will not prompt user\n"), NULL);
lbuf_append(&lbuf,
" -P preserve group vector instead of setting to target's\n",
NULL);
" -P ",
_("preserve group vector instead of setting to target's\n"), NULL);
lbuf_append(&lbuf,
" -p prompt use specified password prompt\n", NULL);
" -p prompt ",
_("use specified password prompt\n"), NULL);
#ifdef HAVE_SELINUX
lbuf_append(&lbuf,
" -r role create SELinux security context with specified role\n",
NULL);
" -r role ",
_("create SELinux security context with specified role\n"), NULL);
#endif
lbuf_append(&lbuf,
" -S read password from standard input\n", NULL);
" -S ",
_("read password from standard input\n"), NULL);
lbuf_append(&lbuf,
" -s [command] run a shell as target user\n", NULL);
" -s [command] ",
_("run a shell as target user\n"), NULL);
#ifdef HAVE_SELINUX
lbuf_append(&lbuf,
" -t type create SELinux security context with specified role\n",
NULL);
" -t type ",
_("create SELinux security context with specified role\n"), NULL);
#endif
lbuf_append(&lbuf,
" -U user when listing, list specified user's privileges\n",
NULL);
" -U user ",
_("when listing, list specified user's privileges\n"), NULL);
lbuf_append(&lbuf,
" -u user run command (or edit file) as specified user\n", NULL);
" -u user ",
_("run command (or edit file) as specified user\n"), NULL);
lbuf_append(&lbuf,
" -V display version information and exit\n", NULL);
" -V ",
_("display version information and exit\n"), NULL);
lbuf_append(&lbuf,
" -v update user's timestamp without running a command\n",
NULL);
" -v ",
_("update user's timestamp without running a command\n"), NULL);
lbuf_append(&lbuf,
" -- stop processing command line arguments\n", NULL);
" -- ",
_("stop processing command line arguments\n"), NULL);
lbuf_print(&lbuf);
lbuf_destroy(&lbuf);
exit(0);