3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-08-26 22:57:25 +02:00

applets/trans: make Bing default engine; misc improvements

This commit is contained in:
Pragmatic Software 2025-08-25 04:36:02 -07:00
parent 8fdd51bc9a
commit 55831b3d4a
No known key found for this signature in database
GPG Key ID: CC916B6E3C84ECCE
2 changed files with 6 additions and 10 deletions

12
applets/trans.pl vendored
View File

@ -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";

View File

@ -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 {}