summaryrefslogtreecommitdiffstats
path: root/g10
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2016-01-18 11:20:15 +0100
committerWerner Koch <wk@gnupg.org>2016-01-18 11:20:15 +0100
commit437965e5622612941ed0fa55584811c65069242e (patch)
tree4977ccb7f8684b95f0a7c286d0ac58ee201ee42f /g10
parentdoc: Fix description of --s2k-* options to match gpg 2.1. (diff)
downloadgnupg2-437965e5622612941ed0fa55584811c65069242e.tar.xz
gnupg2-437965e5622612941ed0fa55584811c65069242e.zip
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>
Diffstat (limited to 'g10')
-rw-r--r--g10/keyedit.c48
-rw-r--r--g10/keylist.c40
-rw-r--r--g10/keyring.c17
-rw-r--r--g10/keyserver.c9
-rw-r--r--g10/sig-check.c21
-rw-r--r--g10/sign.c10
-rw-r--r--g10/trustdb.c14
7 files changed, 86 insertions, 73 deletions
diff --git a/g10/keyedit.c b/g10/keyedit.c
index 497fd1b6c..30f52a4b0 100644
--- a/g10/keyedit.c
+++ b/g10/keyedit.c
@@ -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
diff --git a/g10/keylist.c b/g10/keylist.c
index b2836e8cd..d71bf4f9f 100644
--- a/g10/keylist.c
+++ b/g10/keylist.c
@@ -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->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->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->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->good_sigs)
+ log_info (ngettext("%d good signature\n",
+ "%d good signatures\n", s->good_sigs), s->good_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)
+ 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)
+ 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)
diff --git a/g10/keyring.c b/g10/keyring.c
index ca9a69874..7c7b35508 100644
--- a/g10/keyring.c
+++ b/g10/keyring.c
@@ -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))
diff --git a/g10/keyserver.c b/g10/keyserver.c
index bb7c10536..b0af63d25 100644
--- a/g10/keyserver.c
+++ b/g10/keyserver.c
@@ -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);
diff --git a/g10/sig-check.c b/g10/sig-check.c
index bcf46f8b4..8f976ba7a 100644
--- a/g10/sig-check.c
+++ b/g10/sig-check.c
@@ -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;
}
diff --git a/g10/sign.c b/g10/sign.c
index 081bd99b0..c3ae028ea 100644
--- a/g10/sign.c
+++ b/g10/sign.c
@@ -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)
diff --git a/g10/trustdb.c b/g10/trustdb.c
index cb2b5b98b..d3a186f3f 100644
--- a/g10/trustdb.c
+++ b/g10/trustdb.c
@@ -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++)
{