Skip to content
Mort Yao edited this page Feb 12, 2019 · 4 revisions

Can I use Translate Shell as a library?

Yes, and no.

No because Translate Shell is not designed as a library. Since it does not rely on any Google API key, its quota can be very limited. This is sufficient for reasonable personal use (for example, looking up words or helping you translate articles), however, it might be not enough for building your own application (and doing so may infringe Google's terms of service).

Yes if you want to write a desktop / editor plugin or some text filter to automatize your translation tasks locally.

I got a hanging process after installing and running trans. What should I do?

Of course you did. The default behavior is to await standard input, unless the program found something to translate.

If you have already given input to the program but it took too long to respond, check your network status.

(As of today, China is blocking all Google services through its national firewall system. You may use the -proxy option or set the environment variable HTTP_PROXY to specify an HTTP proxy, or call Translate Shell using proxychains.)

I got an empty output. Should I report an issue to you?

In principle, please don't.

In most cases, empty output is caused by network issues, which can be very hard to reproduce and diagnose on other networks/machines. There is also a possibility that your IP range has been blocked temporarily. Please try with different networks/IP addresses if you encounter this issue.

I tried to translate some very long text but failed to get the complete translation.

There is a limitation on the length of each translation. As a general suggestion, don't try to do everything in one hit. Split your text into sentences or short lines, and translate one at a time.

My terminal does not support ANSI escape sequences and the display looks like a mess. How do I disable them?

Translate Shell uses ANSI escape sequences to render colors and other fancy effects for display. You can disable them easily by using the option -no-ansi, specifying theme as none -theme=none, or faking to the program that your terminal is of dumb type TERM=dumb trans.

I got an error message like rev: stdin: Invalid or incomplete multibyte or wide character.

Please install the FriBidi package.

What is the "home language"?

By default, home language is set to the language of your current locale (i.e. environment variable LC_ALL or LANG). It will affect the display in verbose mode. If you are comfortable with your current locale (for example, en_US.UTF-8), just leave it as it is.

What is the target language, if I don't specify one?

If no target language is specified, text will be translated into the language of your current locale.

How many languages does Google Translate support?

See wiki: Languages for details.

What are those language codes?

A language code is used to exclusively identify a language. Most languages supported by Google Translate have ISO 639-1 codes (two-letter codes); a few languages supported by Google Translate, must be identified using ISO 639-2 codes (three-letter codes) due to the lack of ISO 639-1 codes.

The ISO 639-1 code of the Chinese language is zh; however, an uppercase region code must be appended to distinguish two of its writing systems (zh-CN for Simplified Chinese, used in China and Singapore; zh-TW for Traditional Chinese, used in Taiwan and Hong Kong). zh is an alias of zh-CN.

What is the writing system of my language?

Many languages other than Chinese, also have multiple writing systems (scripts) in use. Google Translate supports only one script for each of these languages.

  • Belarusian (be): Cyrillic alphabet
  • Bosnian (bs): Latin alphabet
  • Hausa (ha): Latin alphabet
  • Javanese (jv or jw): Latin alphabet
  • Kazakh (kk): Cyrillic alphabet
  • Mongolian (mn): Cyrillic alphabet
  • Punjabi (pa): Gurmukhī alphabet
  • Serbian (sr): Cyrillic alphabet
  • Sundanese (su): Latin alphabet
  • Tajik (tg): Cyrillic alphabet
  • Uzbek (uz): Latin alphabet

See wiki: Writing Systems and Fonts for details.

What are right-to-left (RTL) languages, and why do I need GNU FriBidi for them?

Right-to-left (RTL) languages are those languages which make use of right-to-left writing systems, i.e., languages written from right to left. Some languages supported by Google Translate are RTL languages.

  • Arabic (ar): Arabic alphabet
  • Persian (fa): Arabic alphabet
  • Hebrew (he or iw): Hebrew alphabet
  • Urdu (ur): Arabic alphabet
  • Yiddish (yi or ji): Hebrew alphabet

In order to display bi-directional text correctly for these languages, GNU FriBidi, which implements the Unicode bidirectional algorithm, should be used.