gpg: Change some error messages.

* g10/getkey.c (parse_def_secret_key): Change error message.  Replace
log_debug by log_info.
* g10/gpg.c (check_user_ids): Make function static.  Change error
messages.
(main): Change error messages.
* g10/revoke.c (gen_revoke): Ditto.
--

There are other smaller changes not described above.

This change tries to avoid new error messages so not to increase the
the number of translated strings or break too many existing
translations.  It also tries to use existing strings and changes the
quoting to the most common style used in gpg.

Key specifications should in general use double quotes.  Other values
should use single quotes.  However. sometimes it is not easy to
distinguish between values given on the command line and key
specifications.  According to old GNU coding standards diagnostics
should not start capitalized - whether this is a good idea is a
different thing but we used this rules for most strings.  However,
strings which are used interactively should be properly capitalized
and end with a dot.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-12-03 10:39:29 +01:00
parent f42c50dbf0
commit 9fcc047d92
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
6 changed files with 53 additions and 43 deletions

View File

@ -1148,8 +1148,10 @@ parse_def_secret_key (ctrl_t ctrl)
err = classify_user_id (t->d, &desc, 1);
if (err)
{
log_error (_("Invalid value ('%s') for --default-key.\n"),
t->d);
log_error (_("secret key \"%s\" not found: %s\n"),
t->d, gpg_strerror (err));
if (!opt.quiet)
log_info (_("(check argument of option '%s')\n"), "--default-key");
continue;
}
@ -1164,8 +1166,7 @@ parse_def_secret_key (ctrl_t ctrl)
if (err)
{
log_error (_("Error reading from keyring: %s.\n"),
gpg_strerror (err));
log_error (_("key \"%s\" not found: %s\n"), t->d, gpg_strerror (err));
t = NULL;
break;
}
@ -1183,7 +1184,7 @@ parse_def_secret_key (ctrl_t ctrl)
if (! err)
{
if (! warned)
log_debug (_("Using %s as default secret key.\n"), t->d);
log_info (_("using \"%s\" as default secret key\n"), t->d);
break;
}
}

View File

@ -2083,7 +2083,8 @@ get_default_configname (void)
return configname;
}
gpg_error_t
static gpg_error_t
check_user_ids (strlist_t *sp,
int warn_possibly_ambiguous,
int error_if_not_found)
@ -2137,7 +2138,8 @@ check_user_ids (strlist_t *sp,
if (! rc)
rc = err;
log_error (_("Invalid value ('%s')."), t->d);
log_error (_("key \"%s\" not found: %s\n"),
t->d, gpg_strerror (err));
if (!opt.quiet)
log_info (_("(check argument of option '%s')\n"), option);
continue;
@ -2148,8 +2150,8 @@ check_user_ids (strlist_t *sp,
|| desc.mode == KEYDB_SEARCH_MODE_FPR16
|| desc.mode == KEYDB_SEARCH_MODE_FPR20
|| desc.mode == KEYDB_SEARCH_MODE_FPR))
log_info (_("Warning: value '%s' for %s"
" should be a long keyid or a fingerprint.\n"),
log_info (_("Warning: value '%s' for option '%s'"
" should be a long key ID or a fingerprint\n"),
t->d, option);
if (! hd)
@ -2168,7 +2170,8 @@ check_user_ids (strlist_t *sp,
if (! rc)
rc = err;
log_error (_("no such key corresponding to '%s'\n"), t->d);
log_error (_("key \"%s\" not found: %s\n"),
t->d, gpg_strerror (err));
if (!opt.quiet)
log_info (_("(check argument of option '%s')\n"), option);
}
@ -2179,8 +2182,7 @@ check_user_ids (strlist_t *sp,
if (! rc)
rc = err;
log_error (_("error looking up '%s' in keyring: %s.\n"),
t->d, gpg_strerror (err));
log_error (_("key \"%s\" not found: %s\n"), t->d, gpg_strerror (err));
break;
}
@ -2190,8 +2192,7 @@ check_user_ids (strlist_t *sp,
if (! rc)
rc = err;
log_error (_("error reading key block for '%s': %s\n"),
t->d, gpg_strerror (err));
log_error (_("error reading keyblock: %s\n"), gpg_strerror (err));
continue;
}
@ -2254,8 +2255,7 @@ check_user_ids (strlist_t *sp,
size_t fingerprint_bin2_len = sizeof (fingerprint_bin2);
char fingerprint2[2 * MAX_FINGERPRINT_LEN + 1];
log_error (_("Error: the key specification '%s' is ambiguous.\n"),
t->d);
log_error (_("key specification '%s' is ambiguous\n"), t->d);
if (!opt.quiet)
log_info (_("(check argument of option '%s')\n"), option);
@ -2264,8 +2264,7 @@ check_user_ids (strlist_t *sp,
err = keydb_get_keyblock (hd, &kb);
if (err)
log_error (_("error reading key block for '%s': %s.\n"),
t->d, gpg_strerror (err));
log_error (_("error reading keyblock: %s\n"), gpg_strerror (err));
else
{
pk = kb->pkt->pkt.public_key;
@ -2273,8 +2272,12 @@ check_user_ids (strlist_t *sp,
assert (fingerprint_bin2_len == sizeof (fingerprint_bin2));
bin2hex (fingerprint_bin2, MAX_FINGERPRINT_LEN, fingerprint2);
log_error ("'%s' matches at least: %s and %s.\n",
t->d, fingerprint, fingerprint2);
/* TRANSLATORS: The %s prints a key specification which
for example has been given at the command line. Two
lines with fingerprints are printed after this message. */
log_info (_("'%s' matches at least:\n"), t->d);
log_info (" %s\n", fingerprint);
log_info (" %s\n", fingerprint2);
release_kbnode (kb);
}
@ -2283,7 +2286,7 @@ check_user_ids (strlist_t *sp,
|| gpg_err_code (err) == GPG_ERR_EOF))
/* An error (other than "not found"). */
{
log_error (_("Error reading from keyring: %s\n"),
log_error (_("error searching the keyring: %s\n"),
gpg_strerror (err));
if (! rc)
rc = err;
@ -2300,6 +2303,7 @@ check_user_ids (strlist_t *sp,
return rc;
}
int
main (int argc, char **argv)
{
@ -3986,9 +3990,11 @@ main (int argc, char **argv)
sl->flags = (oEncryptToDefaultKey << 2) | 1;
}
else if (have_def_secret_key)
log_info (_("--encrypt-to-default-key specified, but no valid default keys specified.\n"));
log_info (_("option '%s' given, but no valid default keys given\n"),
"--encrypt-to-default-key");
else
log_info (_("--encrypt-to-default-key specified, but --default-key not specified.\n"));
log_info (_("option '%s' given, but option '%s' not given\n"),
"--encrypt-to-default-key", "--default-key");
}
}
@ -4735,7 +4741,8 @@ main (int argc, char **argv)
rc = classify_user_id (argv[i], &desc, 0);
if (rc)
{
log_error (_("Failed to parse '%s'.\n"), argv[i]);
log_error (_("error parsing key specification '%s': %s\n"),
argv[i], gpg_strerror (rc));
g10_exit (1);
}
@ -4747,7 +4754,7 @@ main (int argc, char **argv)
|| desc.mode == KEYDB_SEARCH_MODE_KEYGRIP))
{
log_error (_("'%s' does not appear to be a valid"
" key id, fingerprint or key grip.\n"),
" key ID, fingerprint or keygrip\n"),
argv[i]);
g10_exit (1);
}
@ -4755,27 +4762,26 @@ main (int argc, char **argv)
rc = keydb_search_reset (hd);
if (rc)
{
log_error (_("Failed to reset keyring handle.\n"));
/* This should not happen, thus no need to tranalate
the string. */
log_error ("keydb_search_reset failed: %s\n",
gpg_strerror (rc));
g10_exit (1);
}
rc = keydb_search (hd, &desc, 1, NULL);
if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY)
if (rc)
{
log_error (_("Key '%s' is not available\n"), argv[i]);
g10_exit (1);
}
else if (rc)
{
log_error (_("Failed to find key '%s'\n"), argv[i]);
log_error (_("key \"%s\" not found: %s\n"), argv[i],
gpg_strerror (rc));
g10_exit (1);
}
rc = keydb_get_keyblock (hd, &kb);
if (rc)
{
log_error (_("Failed to read key '%s' from the keyring\n"),
argv[i]);
log_error (_("error reading keyblock: %s\n"),
gpg_strerror (rc));
g10_exit (1);
}

View File

@ -618,7 +618,7 @@ sign_uids (ctrl_t ctrl, estream_t fp,
if (opt.only_sign_text_ids
&& uidnode->pkt->pkt.user_id->attribs)
{
tty_fprintf (fp, _("Skipping User ID \"%s\","
tty_fprintf (fp, _("Skipping user ID \"%s\","
" which is not a text ID.\n"),
user);
uidnode->flag &= ~NODFLG_MARK_A;
@ -4983,7 +4983,7 @@ menu_select_key (KBNODE keyblock, int idx, char *p)
if (found_one)
return 1;
tty_printf (_("No subkey with keyid %s\n"), p);
tty_printf (_("No subkey with key ID '%s'.\n"), p);
return 0;
}

View File

@ -2538,7 +2538,8 @@ ask_user_id (int mode, int full, KBNODE keyblock)
if( strpbrk( aname, "<>" ) )
{
tty_printf(_("Invalid character in name\n"));
tty_printf(_("The characters < and > may not appear in name\n"));
tty_printf(_("The characters '%s' and '%s' may not "
"appear in name\n"), "<", ">");
}
else if( digitp(aname) )
tty_printf(_("Name may not start with a digit\n"));

View File

@ -1705,7 +1705,7 @@ additional_weak_digest (const char* digestname)
if (algo == GCRY_MD_NONE)
{
log_error(_("Unknown weak digest '%s'\n"), digestname);
log_error (_("unknown weak digest '%s'\n"), digestname);
return;
}

View File

@ -615,10 +615,9 @@ gen_revoke (const char *uname)
if (rc)
{
if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
log_error (_("no secret key matches the search term \"%s\"\n"),
uname);
log_error (_("secret key \"%s\" not found\n"), uname);
else
log_error (_("error looking up secret key \"%s\": %s\n"),
log_error (_("secret key \"%s\" not found: %s\n"),
uname, gpg_strerror (rc));
goto leave;
}
@ -640,6 +639,9 @@ gen_revoke (const char *uname)
{
char *info;
/* TRANSLATORS: The %s prints a key specification which
for example has been given at the command line. Several lines
lines with secret key infos are printed after this message. */
log_error (_("'%s' matches multiple secret keys:\n"), uname);
info = format_seckey_info (keyblock->pkt->pkt.public_key);
@ -651,7 +653,7 @@ gen_revoke (const char *uname)
while (! rc)
{
info = format_seckey_info (keyblock->pkt->pkt.public_key);
log_error (" %s\n", info);
log_info (" %s\n", info);
xfree (info);
release_kbnode (keyblock);
keyblock = NULL;