diff options
author | Werner Koch <wk@gnupg.org> | 2015-06-30 21:58:02 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2015-06-30 21:58:45 +0200 |
commit | e76d4c05b24211f3981ab69cddb3fccc17d21e0e (patch) | |
tree | f62e615bffca562ef096cb8babd9e8c2b70379d5 /agent/findkey.c | |
parent | Remove obsolete file g10/comment.c. (diff) | |
download | gnupg2-e76d4c05b24211f3981ab69cddb3fccc17d21e0e.tar.xz gnupg2-e76d4c05b24211f3981ab69cddb3fccc17d21e0e.zip |
agent: Use different translation func for Pinentry strings.
* po/Makevars (XGETTEXT_OPTIONS): Add keyword "L_".
* common/i18n.c (i18n_localegettext): New stub.
* common/i18n.h: Expand the LunderscoreIMPL macro.
* agent/agent.h (L_): New.
(LunderscoreIMPL): New.
* agent/call-pinentry.c (setup_qualitybar): Add arg ctrl anc change
caller.
* agent/findkey.c (try_unprotect_cb): Add local var ctrl.
* agent/genkey.c (check_passphrase_constraints): Replace xtryasprintf
by xtrystrdup to avoid gcc warning. Unfortinately this changes the
string.
(agent_ask_new_passphrase): Cleanup the use of initial_errtext.
--
Static strings in gpg-agent need to be translated according to the
locale set by the caller. This is required so that a gpg-agent can be
started in one locale and a gpg can be run in another. If we don't do
this the static strings (prompt, buttons) are not or in the wrong
locale translated while dynamic strings (e.g. key description) uses
the locale of gpg.
This is only the first part of the change the actual local switching
still needs to be implemented.
Debian-bug-id: 788983
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'agent/findkey.c')
-rw-r--r-- | agent/findkey.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/agent/findkey.c b/agent/findkey.c index 699291dfc..1ca7f0442 100644 --- a/agent/findkey.c +++ b/agent/findkey.c @@ -115,6 +115,7 @@ static int try_unprotect_cb (struct pin_entry_info_s *pi) { struct try_unprotect_arg_s *arg = pi->check_cb_arg; + ctrl_t ctrl = arg->ctrl; size_t dummy; gpg_error_t err; gnupg_isotime_t now, protected_at, tmptime; @@ -123,18 +124,18 @@ try_unprotect_cb (struct pin_entry_info_s *pi) assert (!arg->unprotected_key); arg->change_required = 0; - err = agent_unprotect (arg->ctrl, arg->protected_key, pi->pin, protected_at, + err = agent_unprotect (ctrl, arg->protected_key, pi->pin, protected_at, &arg->unprotected_key, &dummy); if (err) return err; - if (!opt.max_passphrase_days || arg->ctrl->in_passwd) + if (!opt.max_passphrase_days || ctrl->in_passwd) return 0; /* No regular passphrase change required. */ if (!*protected_at) { /* No protection date known - must force passphrase change. */ - desc = xtrystrdup (_("Note: This passphrase has never been changed.%0A" - "Please change it now.")); + desc = xtrystrdup (L_("Note: This passphrase has never been changed.%0A" + "Please change it now.")); if (!desc) return gpg_error_from_syserror (); } @@ -149,8 +150,8 @@ try_unprotect_cb (struct pin_entry_info_s *pi) { /* Passphrase "expired". */ desc = xtryasprintf - (_("This passphrase has not been changed%%0A" - "since %.4s-%.2s-%.2s. Please change it now."), + (L_("This passphrase has not been changed%%0A" + "since %.4s-%.2s-%.2s. Please change it now."), protected_at, protected_at+4, protected_at+6); if (!desc) return gpg_error_from_syserror (); @@ -162,16 +163,16 @@ try_unprotect_cb (struct pin_entry_info_s *pi) /* Change required. */ if (opt.enforce_passphrase_constraints) { - err = agent_get_confirmation (arg->ctrl, desc, - _("Change passphrase"), NULL, 0); + err = agent_get_confirmation (ctrl, desc, + L_("Change passphrase"), NULL, 0); if (!err) arg->change_required = 1; } else { - err = agent_get_confirmation (arg->ctrl, desc, - _("Change passphrase"), - _("I'll change it later"), 0); + err = agent_get_confirmation (ctrl, desc, + L_("Change passphrase"), + L_("I'll change it later"), 0); if (!err) arg->change_required = 1; else if (gpg_err_code (err) == GPG_ERR_CANCELED @@ -1257,8 +1258,8 @@ agent_delete_key (ctrl_t ctrl, const char *desc_text, if (!desc_text) { default_desc = xtryasprintf - ("Do you really want to delete the key identified by keygrip%%0A" - " %s%%0A %%C%%0A?", hexgrip); + (L_("Do you really want to delete the key identified by keygrip%%0A" + " %s%%0A %%C%%0A?"), hexgrip); desc_text = default_desc; } @@ -1281,7 +1282,7 @@ agent_delete_key (ctrl_t ctrl, const char *desc_text, goto leave; err = agent_get_confirmation (ctrl, desc_text_final, - _("Delete key"), _("No"), 0); + L_("Delete key"), L_("No"), 0); if (err) goto leave; @@ -1292,10 +1293,10 @@ agent_delete_key (ctrl_t ctrl, const char *desc_text, { err = agent_get_confirmation (ctrl, - _("Warning: This key is also listed for use with SSH!\n" - "Deleting the key might remove your ability to " - "access remote machines."), - _("Delete key"), _("No"), 0); + L_("Warning: This key is also listed for use with SSH!\n" + "Deleting the key might remove your ability to " + "access remote machines."), + L_("Delete key"), L_("No"), 0); if (err) goto leave; } |