我们安装了Lingua :: Translation并按如下方式使用它
#!/usr/bin/perl
use Lingua::Translate;
my $trans = Lingua::Translate->new
(back_end => 'Babelfish',
src => "en",
dest => "it",);
print $trans->translate("Hello world");
执行此操作会导致以下错误:
Translation back-end failed; Request timed out more than 2 times (Request 1:301 Moved Permanently; Request 2:301 Moved Permanently; Request 3:301 Moved Permanently; ) at /usr/local/share/perl/5.10.1/Lingua/Translate/Babelfish.pm line 206.
答案 0 :(得分:3)
我怀疑这与http://babelfish.yahoo.com/现在重定向到http://www.microsofttranslator.com/的事实有关。我不知道底层引擎是否已经改变。我会检查CPAN是否有Lingua :: Translate的更新版本,或检查perldoc以查看URL是否可在给定后端配置。
之前发生过:请参阅this bug report。
基于该补丁,看起来您可以添加babelfish_uri作为传递给Lingua :: Translate-> new()的哈希元素之一。这不在文档中,只是一个有根据的猜测。