Created
October 21, 2010 20:45
-
-
Save otsune/639320 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use WebService::Simple; | |
use Encode; | |
my $text = join " ", @ARGV; | |
my $googletrans = WebService::Simple->new( | |
base_url => 'http://ajax.googleapis.com/ajax/services/', | |
response_parser => 'JSON', | |
params => {v => '1.0', langpair => 'ja|en'}, | |
); | |
my $response = $googletrans->get( | |
'language/translate', { q => $text} | |
); | |
print encode_utf8($response->parse_response->{responseData}->{translatedText}), "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment