LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs > peonuser
User Name
Password

Notices

Rate this Entry

Google translate in the command line revisited.

Posted 08-22-2011 at 10:25 PM by peonuser
Updated 08-22-2011 at 10:27 PM by peonuser

Borrowed a little code.

$ ./lc.sh "el toro" es en
the bull

$

lc.sh:
Code:
#!/bin/bash
if test -z $3; then
	echo "Usage: $0 \"<str>\" <lang1> <lang2>"
	echo "Translates string \"<str>\" from <lang1> to <lang2>"
	echo "(CLI frontend to Google Translate)"
else 
wget -qO- "http://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=$1&langpair=$2|${3:-$3}" | sed 's/.*"translatedText":"\([^"]*\)".*}/\1\n/'; 
fi
echo ""

No. Language Name Native Language Name Code
1 Afrikaans Afrikaans af
2 Albanian Shqip sq
3 Arabic عربي ar
4 Armenian Հայերէն hy
5 Azerbaijani آذربایجان دیلی az
6 Basque Euskara eu
7 Belarusian Беларуская be
8 Bulgarian Български bg
9 Catalan Català ca
10 Chinese (Simplified) 中文简体 zh-CN
11 Chinese (Traditional) 中文繁體 zh-TW
12 Croatian Hrvatski hr
13 Czech Čeština cs
14 Danish Dansk da
15 Dutch Nederlands nl
16 English English en
17 Estonian Eesti keel et
18 Filipino Filipino tl
19 Finnish Suomi fi
20 French Français fr
21 Galician Galego gl
22 Georgian ქართული ka
23 German Deutsch de
24 Greek Ελληνικά el
25 Haitian Creole Kreyòl ayisyen ht
26 Hebrew עברית iw
27 Hindi हिन्दी hi
28 Hungarian Magyar hu
29 Icelandic Íslenska is
30 Indonesian Bahasa Indonesia id
31 Irish Gaeilge ga
32 Italian Italiano it
33 Japanese 日本語 ja
34 Korean 한국어 ko
35 Latvian Latviešu lv
36 Lithuanian Lietuvių kalba lt
37 Macedonian Македонски mk
38 Malay Malay ms
39 Maltese Malti mt
40 Norwegian Norsk no
41 Persian فارسی fa
42 Polish Polski pl
43 Portuguese Português pt
44 Romanian Română ro
45 Russian Русский ru
46 Serbian Српски sr
47 Slovak Slovenčina sk
48 Slovenian Slovensko sl
49 Spanish Español es
50 Swahili Kiswahili sw
51 Swedish Svenska sv
52 Thai ไทย th
53 Turkish Türkçe tr
54 Ukrainian Українська uk
55 Urdu اردو ur
56 Vietnamese Tiếng Việt vi
57 Welsh Cymraeg cy
58 Yiddish ייִדיש yi
Posted in Uncategorized
Views 365 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 05:19 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration