Spying on People with Guns


Panslation

September 15, 2009 · File under Technical argle-bargle

I wanted to see something translated into everything, for some reason; the code below does it okay. You need a UTF-8-capable console like Terminal on OS X, or redirect to a file and view it in a browser. Example:

$ CLASSPATH=.:google-api-translate-java-0.8.jar java Panslate "unbelievably interesting"
sq: unbelievably interesante
ar: المثيرة للاهتمام
bg: невероятно интересно
ca: increïblement interessant
zh: 令人难以置信的有趣
zh-CN: 令人难以置信的有趣
zh-TW: 令人難以置信的有趣
hr: nevjerojatno zanimljiv
cs: neuvěřitelně zajímavé
da: utroligt interessant
nl: ongelooflijk interessant
en: unbelievably interesting
et: äärmiselt huvitav
tl: unbelievably kagiliw-giliw na
fi: uskomattoman mielenkiintoista
fr: incroyablement intéressante
gl: incrible interesante
de: unglaublich interessant
el: απίστευτα ενδιαφέρον
iw: מעניין שלא תיאמן
hi: अविश्वसनीय दिलचस्प
hu: Hihetetlenül érdekes
id: luar biasa menarik
it: incredibilmente interessante
ja: 信じられないほど面白い
ko: 엄청 재미
lv: neticami interesanti
lt: neįtikėtinai įdomūs
mt: unbelievably interessanti
no: utrolig interessant
fa: unbelievably جالب
pl: niesamowicie ciekawe
pt: incrivelmente interessante
ro: incredibil de interesant
ru: невероятной интересно
sr: невероватно занимљиво
sk: neuveriteľne zaujímavé
sl: Neverjetno zanimivo
es: increíblemente interesante
sv: Otroligt intressant
th: น่าเหลือเชื่อ
tr: inanılmaz ilginç
uk: неймовірною цікаво
vi: không ngờ thú vị

You'll need google-api-translate-java. Here's the Java code:

import java.io.PrintStream;
import java.net.InetAddress;
import com.google.api.translate.Language;
import com.google.api.translate.Translate;

public class Panslate {
  public static void main(String[] args) throws Exception {
    PrintStream out = new PrintStream(System.out, true, "UTF-8");
    Translate.setHttpReferrer(InetAddress.getLocalHost().getHostName());
    for (Language target : Language.values()) {
      if (target == Language.AUTO_DETECT) continue;
      String translatedText = Translate.execute(args[0],
                                                Language.ENGLISH,
                                                target);
      out.println(target + ": " + translatedText);
    }
  }
}

Archive

Categories

Found
Things that suck
Unsolicited advice
Adventure time
Generative art
Fun and games
Electronics
Kids
Technical argle-bargle
Sheet music
Apropos of nothing

A collection of posts about things that suck, and posts that suck about things that don't suck.


RSS feed

@efredricksen
@efred
efredricksen
grumdrig (gh)
grumdrig (bb)
efredricksen
©2022 Eric Fredricksen