From 55831b3d4a726ed334ee0a478a34d1299d5a7294 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Mon, 25 Aug 2025 04:36:02 -0700 Subject: [PATCH] applets/trans: make Bing default engine; misc improvements --- applets/trans.pl | 12 ++++-------- lib/PBot/VERSION.pm | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/applets/trans.pl b/applets/trans.pl index 2fce4e1c..deaacf9a 100755 --- a/applets/trans.pl +++ b/applets/trans.pl @@ -18,7 +18,7 @@ $args =~ s/^\s+|\s+$//g; $args =~ s/\s+--\s+/ /g; my $opts = '-j -no-ansi -no-autocorrect -no-browser -no-pager -no-play'; -$opts .= ' -b' unless $args =~ /^-/; +$opts .= ' -e bing -b' unless $args =~ /^-/; { my $opt_err; @@ -30,7 +30,7 @@ $opts .= ' -b' unless $args =~ /^-/; Getopt::Long::Configure('no_auto_abbrev', 'no_ignore_case'); my %h; - my @allowed = qw/V version H help M man T reference R reference-english S list-engines list-languages list-languages-english list-codes list-all L=s linguist=s e=s engine=s b brief d dictionary identify show-original=s show-original-phonetics=s show-translation=s show-translation-phonetics=s show-prompt-message=s show-languages=s show-original-dictionary=s show-dictionary=s show-alternatives=s hl=s host=s s=s sl=s source=s from=s t=s tl=s target=s to=s/; + my @allowed = qw/V version H h help M man T reference R reference-english S list-engines list-languages list-languages-english list-codes list-all L=s linguist=s e=s engine=s b brief d dictionary identify show-original=s show-original-phonetics=s show-translation=s show-translation-phonetics=s show-prompt-message=s show-languages=s show-original-dictionary=s show-dictionary=s show-alternatives=s hl=s host=s s=s sl=s source=s from=s t=s tl=s target=s to=s verbose/; my ($ret, $rest) = GetOptionsFromString($args, \%h, @allowed); if ($opt_err) { @@ -42,12 +42,8 @@ $opts .= ' -b' unless $args =~ /^-/; print "Error parsing options.\n"; exit; } - - if (not @$rest) { - print "Missing phrase to translate.\n"; - exit; - } } -my $result = `trans $opts $args`; +my $result = `trans $opts $args 2>&1`; +$result =~ s/\033.*?m//g; print "$result\n"; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 737d5af2..2da732cb 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4880, - BUILD_DATE => "2025-07-30", + BUILD_REVISION => 4881, + BUILD_DATE => "2025-08-25", }; sub initialize {}