As far as I know, there are two posts on this topic: Can I use Mathematica to translate a English word to a Chinese characters? and *How can I use Mathematica to get the translated result from the Google Translate webpage?
But to my surprise, they both received no answers and no upvotes (until I upvoted them...). The second post was marked as duplicates to Export to Google Spreadsheet with OAuthAuthentication which I really don't understand. Why does translation have something to do with authentication?
To make my question specific, for example, I have a list of names
namelist={"Takaaki Kajita", "Arthur B. McDonald", "Isamu Akasaki", "Hiroshi \
Amano", "Shuji Nakamura"}
I want to translate this list into Chinese using Google Translate or other translation services:
{"隆明朱音", "阿瑟 麦克唐纳", "赤崎勇", "天野浩", "中村修二"}
I want to have a function, onlineTran
. So
onlineTran[namelist,"Chinese"]
will give the translated list.
I found there are no translated results in the source HTML page, so I think Import
probably won't work.
update
Both Alexey Golyshev and Rashid provide great solutions, though in terms of the quality of translation, Rashid's Google Translate solution is much better.
I want to add a workaround that is only specific to my example. My example actually comes from my recent post : How to make a picture grid of all Nobel Laureates in physics?
So the these names are all famous! They all got wikipedia pages! Fortunately, I just found Mathematica provides a function called WikipediaData
which is quite useful. So here is the specific solution.
Clear[wikiTranslation];
wikiTranslation[word_,language_:"Chinese"]:=language/.WikipediaData[word,"TitleTranslationRules"]
so
wikiTranslation/@ namelist
gives result
{"梶田隆章", "阿瑟 麦克唐纳", "赤崎勇", "天野浩", "中村修二"}
And actually this results are more accurate than google translation. e.g. 梶田隆章 is the official translation appears on all media in China
I think this wikipedia method should be the best solution for proper names: such as celebrity, countries, famous place etc