Use ngettext for some strings.

* scd/app-openpgp.c (build_enter_admin_pin_prompt): Use ngettext for
some diagnostics.
(do_genkey): Ditto.
* g10/keyedit.c (check_all_keysigs, menu_delsig, menu_clean): Ditto.
* g10/keylist.c (print_signature_stats): Ditto.
* g10/keyserver.c (keyserver_refresh): Ditto.
* g10/sig-check.c (check_signature_metadata_validity): Ditto.
* g10/sign.c (do_sign): Ditto.
* g10/trustdb.c (reset_trust_records): Ditto.
(validate_keys): Use a table like diagnostic output.
--

Suggested-by: Ineiev <ineiev@gnu.org>
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-01-18 11:20:15 +01:00
parent 56275e4392
commit 437965e562
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
8 changed files with 95 additions and 74 deletions

View File

@ -382,23 +382,25 @@ check_all_keysigs (KBNODE keyblock, int only_selected, int only_selfsigs)
}
if (!has_selfsig)
mis_selfsig++;
if (inv_sigs == 1)
tty_printf (_("1 bad signature\n"));
else if (inv_sigs)
tty_printf (_("%d bad signatures\n"), inv_sigs);
if (no_key == 1)
tty_printf (_("1 signature not checked due to a missing key\n"));
else if (no_key)
tty_printf (_("%d signatures not checked due to missing keys\n"), no_key);
if (oth_err == 1)
tty_printf (_("1 signature not checked due to an error\n"));
else if (oth_err)
tty_printf (_("%d signatures not checked due to errors\n"), oth_err);
if (mis_selfsig == 1)
tty_printf (_("1 user ID without valid self-signature detected\n"));
else if (mis_selfsig)
tty_printf (_("%d user IDs without valid self-signatures detected\n"),
mis_selfsig);
if (inv_sigs)
tty_printf (ngettext("%d bad signature\n",
"%d bad signatures\n", inv_sigs), inv_sigs);
if (no_key)
tty_printf (ngettext("%d signature not checked due to a missing key\n",
"%d signatures not checked due to missing keys\n",
no_key), no_key);
if (oth_err)
tty_printf (ngettext("%d signature not checked due to an error\n",
"%d signatures not checked due to errors\n",
oth_err), oth_err);
if (mis_selfsig)
tty_printf (ngettext("%d user ID without valid self-signature detected\n",
"%d user IDs without valid self-signatures detected\n",
mis_selfsig), mis_selfsig);
return inv_sigs || no_key || oth_err || mis_selfsig;
}
@ -3722,8 +3724,8 @@ menu_delsig (KBNODE pub_keyblock)
if (changed)
{
commit_kbnode (&pub_keyblock);
tty_printf (changed == 1 ? _("Deleted %d signature.\n")
: _("Deleted %d signatures.\n"), changed);
tty_printf (ngettext("Deleted %d signature.\n",
"Deleted %d signatures.\n", changed), changed);
}
else
tty_printf (_("Nothing deleted.\n"));
@ -3769,11 +3771,9 @@ menu_clean (KBNODE keyblock, int self_only)
}
else if (sigs)
{
tty_printf (sigs == 1 ?
_("User ID \"%s\": %d signature removed\n") :
_("User ID \"%s\": %d signatures removed\n"),
user, sigs);
tty_printf (ngettext("User ID \"%s\": %d signature removed\n",
"User ID \"%s\": %d signatures removed\n",
sigs), user, sigs);
modified = 1;
}
else

View File

@ -464,25 +464,23 @@ print_signature_stats (struct keylist_context *s)
if (!s->check_sigs)
return; /* Signature checking was not requested. */
if (s->good_sigs == 1)
log_info (_("1 good signature\n"));
else if (s->good_sigs)
log_info (_("%d good signatures\n"), s->good_sigs);
if (s->good_sigs)
log_info (ngettext("%d good signature\n",
"%d good signatures\n", s->good_sigs), s->good_sigs);
if (s->inv_sigs == 1)
log_info (_("1 bad signature\n"));
else if (s->inv_sigs)
log_info (_("%d bad signatures\n"), s->inv_sigs);
if (s->inv_sigs)
log_info (ngettext("%d bad signature\n",
"%d bad signatures\n", s->inv_sigs), s->inv_sigs);
if (s->no_key == 1)
log_info (_("1 signature not checked due to a missing key\n"));
else if (s->no_key)
log_info (_("%d signatures not checked due to missing keys\n"), s->no_key);
if (s->no_key)
log_info (ngettext("%d signature not checked due to a missing key\n",
"%d signatures not checked due to missing keys\n",
s->no_key), s->no_key);
if (s->oth_err == 1)
log_info (_("1 signature not checked due to an error\n"));
else if (s->oth_err)
log_info (_("%d signatures not checked due to errors\n"), s->oth_err);
if (s->oth_err)
log_info (ngettext("%d signature not checked due to an error\n",
"%d signatures not checked due to errors\n",
s->oth_err), s->oth_err);
}
@ -562,7 +560,9 @@ list_all (ctrl_t ctrl, int secret, int mark_secret)
if (rc && gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
log_error ("keydb_search_next failed: %s\n", gpg_strerror (rc));
if (keydb_get_skipped_counter (hd))
log_info (_("Warning: %lu key(s) skipped due to their large size\n"),
log_info (ngettext("Warning: %lu key skipped due to its large size\n",
"Warning: %lu keys skipped due to their large sizes\n",
keydb_get_skipped_counter (hd)),
keydb_get_skipped_counter (hd));
if (opt.check_sigs && !opt.with_colons)

View File

@ -1564,8 +1564,10 @@ keyring_rebuild_cache (void *token,int noisy)
goto leave;
if ( !(++count % 50) && noisy && !opt.quiet)
log_info(_("%lu keys cached so far (%lu signatures)\n"),
count, sigcount );
log_info (ngettext("%lu keys cached so far (%lu signature)\n",
"%lu keys cached so far (%lu signatures)\n",
sigcount),
count, sigcount);
}
} /* end main loop */
if (rc == -1)
@ -1575,8 +1577,15 @@ keyring_rebuild_cache (void *token,int noisy)
log_error ("keyring_search failed: %s\n", gpg_strerror (rc));
goto leave;
}
if(noisy || opt.verbose)
log_info(_("%lu keys cached (%lu signatures)\n"), count, sigcount );
if (noisy || opt.verbose)
{
log_info (ngettext("%lu key cached",
"%lu keys cached", count), count);
log_printf (ngettext(" (%lu signature)\n",
" (%lu signatures)\n", sigcount), sigcount);
}
if (tmpfp)
{
if (iobuf_close (tmpfp))

View File

@ -1403,7 +1403,7 @@ keyserver_refresh (ctrl_t ctrl, strlist_t users)
struct keyserver_spec *keyserver=desc[i].skipfncvalue;
if (!opt.quiet)
log_info (_("refreshing 1 key from %s\n"), keyserver->uri);
log_info (_("refreshing %d key from %s\n"), 1, keyserver->uri);
/* We use the keyserver structure we parsed out before.
Note that a preferred keyserver without a scheme://
@ -1436,10 +1436,9 @@ keyserver_refresh (ctrl_t ctrl, strlist_t users)
{
if (!opt.quiet)
{
if(count==1)
log_info(_("refreshing 1 key from %s\n"), tmpuri);
else
log_info(_("refreshing %d keys from %s\n"), count, tmpuri);
log_info (ngettext("refreshing %d key from %s\n",
"refreshing %d keys from %s\n",
count), count, tmpuri);
}
xfree (tmpuri);

View File

@ -268,11 +268,11 @@ check_signature_metadata_validity (PKT_public_key *pk, PKT_signature *sig,
if( pk->timestamp > sig->timestamp )
{
ulong d = pk->timestamp - sig->timestamp;
log_info(d==1
?_("public key %s is %lu second newer than the signature\n")
:_("public key %s is %lu seconds newer than the signature\n"),
keystr_from_pk(pk),d );
if( !opt.ignore_time_conflict )
log_info
(ngettext("public key %s is %lu second newer than the signature\n",
"public key %s is %lu seconds newer than the signature\n",
d), keystr_from_pk (pk), d);
if (!opt.ignore_time_conflict)
return GPG_ERR_TIME_CONFLICT; /* pubkey newer than signature. */
}
@ -280,12 +280,11 @@ check_signature_metadata_validity (PKT_public_key *pk, PKT_signature *sig,
if( pk->timestamp > cur_time )
{
ulong d = pk->timestamp - cur_time;
log_info( d==1
? _("key %s was created %lu second"
" in the future (time warp or clock problem)\n")
: _("key %s was created %lu seconds"
" in the future (time warp or clock problem)\n"),
keystr_from_pk(pk),d );
log_info (ngettext("key %s was created %lu second"
" in the future (time warp or clock problem)\n",
"key %s was created %lu seconds"
" in the future (time warp or clock problem)\n",
d), keystr_from_pk (pk), d);
if( !opt.ignore_time_conflict )
return GPG_ERR_TIME_CONFLICT;
}

View File

@ -235,15 +235,15 @@ do_sign (PKT_public_key *pksk, PKT_signature *sig,
if (pksk->timestamp > sig->timestamp )
{
ulong d = pksk->timestamp - sig->timestamp;
log_info (d==1 ? _("key has been created %lu second "
"in future (time warp or clock problem)\n")
: _("key has been created %lu seconds "
"in future (time warp or clock problem)\n"), d );
log_info (ngettext("key %s was created %lu second"
" in the future (time warp or clock problem)\n",
"key %s was created %lu seconds"
" in the future (time warp or clock problem)\n",
d), keystr_from_pk (pksk), d);
if (!opt.ignore_time_conflict)
return gpg_error (GPG_ERR_TIME_CONFLICT);
}
print_pubkey_algo_note (pksk->pubkey_algo);
if (!mdalgo)

View File

@ -1842,8 +1842,14 @@ reset_trust_records(void)
}
if (opt.verbose)
log_info (_("%d keys processed (%d validity counts cleared)\n"),
count, nreset);
{
log_info (ngettext("%d key processed",
"%d keys processed",
count), count);
log_printf (ngettext(" (%d validity count cleared)\n",
" (%d validity counts cleared)\n",
nreset), nreset);
}
}
/*
@ -1952,8 +1958,8 @@ validate_keys (int interactive)
klist = utk_list;
log_info(_("%d marginal(s) needed, %d complete(s) needed, %s trust model\n"),
opt.marginals_needed,opt.completes_needed,trust_model_string());
log_info ("marginals needed: %d completes needed: %d trust model: %s\n",
opt.marginals_needed, opt.completes_needed, trust_model_string ());
for (depth=0; depth < opt.max_cert_depth; depth++)
{

View File

@ -1874,8 +1874,11 @@ build_enter_admin_pin_prompt (app_t app, char **r_prompt)
remaining = value[6];
xfree (relptr);
log_info(_("%d Admin PIN attempts remaining before card"
" is permanently locked\n"), remaining);
log_info (ngettext("%d Admin PIN attempt remaining before card"
" is permanently locked\n",
"%d Admin PIN attempts remaining before card"
" is permanently locked\n",
remaining), remaining);
if (remaining < 3)
{
@ -3587,8 +3590,13 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags,
log_error (_("generating key failed\n"));
goto leave;
}
log_info (_("key generation completed (%d seconds)\n"),
(int)(time (NULL) - start_at));
{
int nsecs = (int)(time (NULL) - start_at);
log_info (ngettext("key generation completed (%d second)\n",
"key generation completed (%d seconds)\n",
nsecs), nsecs);
}
keydata = find_tlv (buffer, buflen, 0x7F49, &keydatalen);
if (!keydata)