#!/usr/bin/perl
use v5.030; # strictness implied
use warnings;
use Path::Tiny;
my $file_in = path("/home/fritz/Desktop/1.enchanto.txt");
my $file_out = path('/home/fritz/Desktop/1.enc_trans.txt');
my $lang = 'es';
my $command = 'trans -b :$lang "$para">$buffer';
my $guts = $file_in->slurp_utf8;
my @spl = split('\n', $guts);
say @spl;
my $buffer;
for my $para (@spl){
say $para;
my $trans = system("$command");
say $buffer;
#$file_out->spew_utf8( $para, $trans );
}
__END__
####
foreach (@matching2) {
my $eng_path = path( $vars{eng_captions}, $_ );
say $fh "##$_##";
my $rus_path = path( $vars{rus_captions}, $_ )->touchpath;
say "rus_path is $rus_path";
my $content = path($eng_path)->slurp_utf8;
$content =~ s/^\s+|\s+$//g;
say $fh "$content";
system("trans :$lang file://$eng_path >$rus_path");
}
####
print "Get other translations(y/n)?: ";
my $prompt = ;
chomp $prompt;
if ( $prompt eq ( "y" or "Y" ) ) {
my @translators = qw /yandex bing/;
for my $remote (@translators) {
my $trans_munge = path( $vars{translations}, "$remote." . $munge );
## use trans shell
say "getting translation from $remote";
system("trans :$lang -e $remote file://$in_path >$trans_munge");
}