This is an automated email from the git hooks/post-receive script. nodens-guest pushed a commit to annotated tag OpenPGP_Applet-0.9 in repository openpgp-applet.
commit 4b7d9f71a47dfdc8d5e594ae40c44745c000a595 Author: Clément Hermann (nodens) <[email protected]> Date: Sun Nov 23 00:19:51 2014 +0100 use Locale::TextDomain (from libperl-intl) ... Instead of plain old Locale::gettext. This is mainly to offer easier distribution (dist::zilla plugin, allows to search .mo files both in File::Sharedir and standard GNU gettext directories), but it has interesting side-effects : - Easier to write/read translated strings (__"string" notation) - Has a pure perl implementation as well as XS one (portability) - according to some, MAY be faster than Locale::gettext. --- bin/openpgp-applet | 90 ++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 46 deletions(-) diff --git a/bin/openpgp-applet b/bin/openpgp-applet index 518561d..d8f0d4c 100755 --- a/bin/openpgp-applet +++ b/bin/openpgp-applet @@ -69,10 +69,9 @@ use Switch; use DateTime; use File::ShareDir; -use Locale::gettext; +use Locale::TextDomain (OpenPGP_Applet); use POSIX; setlocale(LC_MESSAGES, ""); -textdomain("OpenPGP_Applet"); =head1 GLOBALS @@ -161,12 +160,12 @@ sub build_statusicon { my $icon = Gtk2::StatusIcon->new; $icon->set_visible(FALSE); $icon->set_from_icon_name('seahorse'); - $icon->set_tooltip($encoding->decode(gettext('OpenPGP encryption applet'))); + $icon->set_tooltip($encoding->decode(__"OpenPGP encryption applet")); my $menu = Gtk2::Menu->new; - my $mexit = Gtk2::MenuItem->new($encoding->decode(gettext('Exit'))); + my $mexit = Gtk2::MenuItem->new($encoding->decode(__"Exit")); $mexit->signal_connect('activate' => sub { Gtk2->main_quit; }); - my $mabout = Gtk2::MenuItem->new($encoding->decode(gettext('About'))); + my $mabout = Gtk2::MenuItem->new($encoding->decode(__"About")); $mabout->signal_connect('activate' => sub { Gtk2->show_about_dialog( $main_window, 'program-name' => 'OpenPGP Applet', @@ -219,19 +218,19 @@ sub build_action_menu { my $text_type = detect_text_type(get_validated_clipboard_text()); if ($text_type eq 'text' or $text_type eq 'none') { - my $msymencrypt = Gtk2::MenuItem->new_with_mnemonic($encoding->decode(gettext('Encrypt Clipboard with _Passphrase'))); + my $msymencrypt = Gtk2::MenuItem->new_with_mnemonic($encoding->decode(__"Encrypt Clipboard with _Passphrase")); $msymencrypt->signal_connect('activate' => sub { operate_on_clipboard(\&symmetric_encrypt, ['text']); }); $action_menu->append($msymencrypt); - my $msignencrypt = Gtk2::MenuItem->new_with_mnemonic($encoding->decode(gettext('Sign/Encrypt Clipboard with Public _Keys'))); + my $msignencrypt = Gtk2::MenuItem->new_with_mnemonic($encoding->decode(__"Sign/Encrypt Clipboard with Public _Keys")); $msignencrypt->signal_connect('activate' => sub { operate_on_clipboard(\&public_crypto, ['text']); }); $action_menu->append($msignencrypt); } if ($text_type eq 'message' or $text_type eq 'signed') { - my $mdecryptver = Gtk2::MenuItem->new_with_mnemonic($encoding->decode(gettext('_Decrypt/Verify Clipboard'))); + my $mdecryptver = Gtk2::MenuItem->new_with_mnemonic($encoding->decode(__"_Decrypt/Verify Clipboard")); $mdecryptver->signal_connect('activate' => sub { operate_on_clipboard(\&decrypt_verify, ['message', 'signed']); }); $action_menu->append($mdecryptver); } - my $mmanage = Gtk2::MenuItem->new_with_mnemonic($encoding->decode(gettext('_Manage Keys'))); + my $mmanage = Gtk2::MenuItem->new_with_mnemonic($encoding->decode(__"_Manage Keys")); $mmanage->signal_connect('activate' => sub { manage_keys(); }); $action_menu->append($mmanage); @@ -271,7 +270,7 @@ sub text_is_of_type { return ( 0, $encoding->decode( - gettext("The clipboard does not contain valid input data.")) + __"The clipboard does not contain valid input data.") ); } return (1); @@ -322,17 +321,17 @@ sub get_status { # Below taken from doc/DETAILS in GnuPG's sources switch ($code) { case "o" { $trusted = FALSE; - $status = $encoding->decode(gettext("Unknown Trust")); } + $status = $encoding->decode(__"Unknown Trust"); } case "-" { $trusted = FALSE; - $status = $encoding->decode(gettext("Unknown Trust")); } + $status = $encoding->decode(__"Unknown Trust"); } case "q" { $trusted = FALSE; - $status = $encoding->decode(gettext("Unknown Trust")); } + $status = $encoding->decode(__"Unknown Trust"); } case "m" { $trusted = FALSE; - $status = $encoding->decode(gettext("Marginal Trust")); } + $status = $encoding->decode(__"Marginal Trust"); } case "f" { $trusted = TRUE; - $status = $encoding->decode(gettext("Full Trust")); } + $status = $encoding->decode(__"Full Trust"); } case "u" { $trusted = TRUE; - $status = $encoding->decode(gettext("Ultimate Trust")); } + $status = $encoding->decode(__"Ultimate Trust"); } else { return; } } return ($status, $trusted); @@ -385,9 +384,9 @@ sub make_pub_key_list { my $list = Gtk2::SimpleList->new ( "" => 'bool', # C_SELECT - $encoding->decode(gettext("Name")) => 'text', # C_NAME - $encoding->decode(gettext("Key ID")) => 'text', # C_KEYID - $encoding->decode(gettext("Status")) => 'text', # C_STATUS + $encoding->decode(__"Name") => 'text', # C_NAME + $encoding->decode(__"Key ID") => 'text', # C_KEYID + $encoding->decode(__"Status") => 'text', # C_STATUS "" => 'text', # C_FINGERPRINT "" => 'text', # C_USERIDS "" => 'bool' # C_TRUSTED @@ -419,10 +418,10 @@ sub make_pub_key_list { my $row = ($path->get_indices)[0]; my $fingerprint = join(" ", (${$list->{data}}[$row][C_FINGERPRINT] =~ m/..../g)); - my $fingerprint_label = $encoding->decode(gettext("Fingerprint:")); + my $fingerprint_label = $encoding->decode(__"Fingerprint:"); my $uids = "${$list->{data}}[$row][C_USERIDS]"; my $uids_label = $encoding->decode( - ngettext("User ID:", "User IDs:", ($uids =~ tr/\n//) + 1)); + __n("User ID:", "User IDs:", ($uids =~ tr/\n//) + 1)); my $text = sprintf("%s\n%s\n%s\n%s", $uids_label, $uids, $fingerprint_label, $fingerprint); $tooltip->set_text("$text"); @@ -451,8 +450,7 @@ sub make_priv_key_combo { qw/Glib::String Glib::String Glib::String Glib::String/); my $iter = $list_store->append; $list_store->set ($iter, - COMBO_NAME, $encoding->decode(gettext( - "None (Don't sign)")), + COMBO_NAME, $encoding->decode(__"None (Don't sign)"), COMBO_KEYID, "", COMBO_FINGERPRINT, "", COMBO_ROLE, "none"); @@ -515,7 +513,7 @@ sub choose_keys { my $pub_keys_ref = shift; my $pub_key_label = Gtk2::Label->new( - $encoding->decode(gettext("Select recipients:"))); + $encoding->decode(__"Select recipients:")); my $pub_key_list = make_pub_key_list($pub_keys_ref); my $pub_key_list_scroll = Gtk2::ScrolledWindow->new; @@ -523,20 +521,20 @@ sub choose_keys { $pub_key_list_scroll->add($pub_key_list); my $hide_recipients_checkbox = Gtk2::CheckButton->new( - $encoding->decode(gettext("Hide recipients"))); + $encoding->decode(__"Hide recipients")); $hide_recipients_checkbox->set_has_tooltip(TRUE); $hide_recipients_checkbox->set_tooltip_text( - $encoding->decode(gettext("Hide the user IDs of all recipients of " . + $encoding->decode(__("Hide the user IDs of all recipients of " . "an encrypted message. Otherwise anyone " . "that sees the encrypted message can see " . "who the recipients are."))); my $priv_key_label = Gtk2::Label->new( - $encoding->decode(gettext("Sign message as:"))); + $encoding->decode(__"Sign message as:")); my $priv_key_combo = make_priv_key_combo($priv_keys_ref); - my $dialog = Gtk2::Dialog->new($encoding->decode(gettext("Choose keys")), + my $dialog = Gtk2::Dialog->new($encoding->decode(__"Choose keys"), $main_window, 'destroy-with-parent', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok' ); $dialog->set_default_size(650,500); @@ -575,10 +573,10 @@ sub choose_keys { if (@list_selection) { my @unauth = grep { ! $_->[C_TRUSTED] } @list_selection; if (@unauth) { - my $title = $encoding->decode(gettext( - "Do you trust these keys?" - )); - my $warning = $encoding->decode(ngettext( + my $title = $encoding->decode( + __"Do you trust these keys?" + ); + my $warning = $encoding->decode(__n( "The following selected key is not fully trusted:", "The following selected keys are not fully trusted:", scalar @unauth @@ -596,7 +594,7 @@ sub choose_keys { my $key_name = "$key->[C_NAME] ($key->[C_KEYID])"; $msg = sprintf("%s%s\n", $msg, $key_name); } - my $question = $encoding->decode(ngettext( + my $question = $encoding->decode(__n( "Do you trust this key enough to use it anyway?", "Do you trust these keys enough to use them anyway?", scalar @unauth @@ -610,8 +608,8 @@ sub choose_keys { if (!@recipients && !$signer) { display_error($dialog, - $encoding->decode(gettext("No keys selected")), - $encoding->decode(gettext( + $encoding->decode(__"No keys selected"), + $encoding->decode(__( "You must select a private key to sign the " . "message, or some public keys to encrypt the " . "message, or both." @@ -640,8 +638,8 @@ sub public_crypto { if (@priv_keys == 0 && @pub_keys == 0) { display_error($main_window, - $encoding->decode(gettext("No keys available")), - $encoding->decode(gettext( + $encoding->decode(__"No keys available"), + $encoding->decode(__( "You need a private key to sign messages or a " . "public key to encrypt messages." ))); @@ -770,7 +768,7 @@ sub gpg_operate_on_text { else { display_error( $main_window, - $encoding->decode(gettext("GnuPG error")), + $encoding->decode(__"GnuPG error"), $std_out . "\n\n" . $std_err ); return; @@ -791,7 +789,7 @@ sub operate_on_clipboard { display_error( $main_window, $clip_error, # already translated and decoded - $encoding->decode(gettext("Therefore the operation cannot be " . + $encoding->decode(__("Therefore the operation cannot be " . "performed.")) ); return; @@ -841,14 +839,14 @@ sub display_output { my $dialog = Gtk2::MessageDialog->new( $main_window, 'destroy-with-parent', 'info', 'ok', - $encoding->decode(gettext("GnuPG results")) + $encoding->decode(__"GnuPG results") ); my $my_width_request = 800; my $my_height_request = 600; # TRANSLATORS: GnuPG stdout (encrypted or decrypted message) - $dialog->format_secondary_text(sprintf($encoding->decode(gettext( - "Output of GnuPG:" - )))); + $dialog->format_secondary_text(sprintf($encoding->decode( + __"Output of GnuPG:" + ))); my $msg_area = $dialog->get_content_area; @@ -871,9 +869,9 @@ sub display_output { if (defined $std_err && length($std_err)) { my $std_err_title = Gtk2::Label->new( # TRANSLATORS: GnuPG stderr (other informational messages) - $encoding->decode(gettext( - "Other messages provided by GnuPG:" - ))); + $encoding->decode( + __"Other messages provided by GnuPG:" + )); $std_err_title->set_alignment(0, 0); $std_err_title->set_padding(10, 0); $msg_area->pack_start($std_err_title, FALSE, FALSE, 0); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/openpgp-applet.git _______________________________________________ Pkg-perl-cvs-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits
