-
Notifications
You must be signed in to change notification settings - Fork 393
Readme_es.md
Translate Shell (formerly Google Translate CLI) is a command-line translator powered by Google Translate (default), Bing Translator, Yandex.Translate, and Apertium. It gives you easy access to one of these translation engines in your terminal:
$ trans 'Saluton, Mondo!'
Saluton, Mondo!
Hola, Mundo!
Translations of Saluton, Mondo!
[ Esperanto -> Spanish ]
Saluton ,
Hola,
Mondo !
Mundo!
Por defecto, se muestran las traducciones detalladas. Pero tambien puede realizar traducciones rapidas: (donde solo se mostrara la frase traducida directamente)
$ trans -brief 'Saluton, Mondo!'
Hola, Mundo!
Translate Shell tambien puede ser usado como un traductor en tiempo real; donde el texto de traduce liena por linea a medida que se escribe:
$ trans -shell -brief
> Rien ne réussit comme le succès.
Noda satisface mas que el exito.
> Was mich nicht umbringt, macht mich stärker.
Lo que no te mata te hace mas fuerte.
> Юмор есть остроумие глубокого чувства.
El hummor tiene un toque de ingenio.
> 學而不思則罔,思而不學則殆。
Aprender sin pensar en una causa perdida, pensar sin aprender es peligroso.
> 幸福になるためには、人から愛されるのが一番の近道。
Se quieres ser feliz,la mejor forma de serlo es amando a las personas.
Translate Shell puede trabajar con varios compiladores de los sistemas POSIX, sienod algunos de ellos:
- GNU/Linux
- macOS
- FreeBSD
- Windows (Cygwin or MSYS2)
-
GNU Awk (gawk) 4.0 or later
- Este proggrama depende fuertemente de las extensiones GNU de AWK language, que no pueden ser usadas para otras implementaciones AWK (ej. nawk).
- Como obtener el gawk:
- gawk viene con todas las versiones de GNU/Linux.
- En FreeSBD, gwak esta disponible en los puertos.
- En El en macOS gawk esta disponible en los MacPorts y en Homebrew.
-
GNU Bash or Zsh
- Usted puede usar Translate Shell con cualquier de la consolas de linux que desee (bash, zsh, ksh, tcsh, fish, etc.); sin embargo, el script wrapper necesita que esten instaladas bash o zsh.
Estas dependencias no son obligatorias, pero se recomienda su uso para un mejor funcionamiento del programa:
- curl con soporte OpenSSL
-
GNU FriBidi: una implementacion del algoritmo Unicode Bidireccional Bidirectional (bidi)
- necesario para mostrar los texto de dercha a izquierda en los scripts (ej. Arabic, Hebrew)
-
mplayer, mpv, mpg123, o eSpeak
- necesaria para la funcion de "pronunciar el texto"
-
less, more or most
- necesaria para el final de la pagina
-
rlwrap: a GNU readline wrapper
- necesaria para editar el estilo de las lineas de lectura e historia en la consola interactiva.
-
aspell o hunspell
- necesaria para la correccion de ortografia
Es la manera que se tiene de corresponder las fuentes del lenguaje(s) / script (s) que desea mostrar en el terminal. Revise wiki: Writing Systems and Fonts para mas detalles sobre los scripts o tipos de fuente unicode.
Inicie una consola interactiva y traduzca cualquier cosa desde su lenguaje nativo: (in bash or zsh)
$ gawk -f <(curl -Ls git.io/translate) -- -shell
(in fish)
$ gawk -f (curl -Ls git.io/translate | psub) -- -shell
Descargue archivo auto ejecutable y coloquelo donde desee. Esto es todo lo que necesita $ wget git.io/trans $ chmod +x ./trans
Esto es una firma GPG.
Usando Antigen (Recomendado para usuarios Zsh)
Agrega la siguiente linea en tu archivo .zshrc
:
antigen bundle soimort/translate-shell
Revise wiki: Distros en la parte de instalar desde un administrador de paquetes especifico.
$ clone git https://github.com/soimort/translate-shell
$ cd translate-shell/
$ make
$ [sudo] make install
Si tiene zsh pero no tiene bash en su equipo, compile con la instruccion:
$ make TARGET=zsh
El 'prefijo' de instalacion por defecto es /usr/local
. PAra instalar el programa en otro sitio use la instruccion:
$ [sudo] make PREFIX=/usr install
El traductor de google puede identificar el lenguaje original automaticamente y Translate Shell traduce el texto originial a tu lenguaje local
.
$ trans vorto
Traducir una palabra a frances:
$ trans :fr word
Traducir una palabra a chino y japones: (use un signo mas "+
" para separar los lenguajes que desea)
$ trans :zh+ja word
Puede usar el signo igual ("=
") puede usar en lugar de los dos puntos (":
"). Notese que algunas consolas (ej. zsh), interpretan el signo igual de forma distinta, es por esto que el argumento donde se especifican los luenguajes debe estar protegido:
$ trans {=zh+ja} word
$ trans '=zh+ja' word
tambien puede usarla opcion -target
(-t
) para especifcar el lenguaje que desea:
$ trans -t zh+ja word
El traductor de google podria equivocarse al identificar el lenguaje original:
$ trans 手紙
En ese caso, debe especificar el lenguaje explicitamente:
$ trans ja: 手紙
$ trans zh: 手紙
Tambien puede usar la opcion -source
(-s
) para especificar el lenguaje:
$ trans -s ja 手紙
Traducir cada palabra por separado:
$ trans en:zh word processor
Colocar todas las palabras en un argumento y traducirlas completas:
$ trans en:zh "word processor"
Traducir una oracion es similar a traducir una frase; puede hacerse colocando la oracion como argumento entre comillas:
$ trans :zh "To-morrow, and to-morrow, and to-morrow,"
$ trans :zh 'To-morrow, and to-morrow, and to-morrow,'
Tambien puede traducir varias lineas de oraciones:
$ trans :zh "Creeps in this petty pace from day to day,
> To the last syllable of recorded time;
> And all our yesterdays have lighted fools
> The way to dusty death."
PAra evitar que los signos de puntuacion (e.g. "!
") u otros caracteres sean interpretados por la consola, use comillas simples:
$ trans :zh 'Out, out, brief candle!'
Sin embargo existen algunos casos donde sera necesario usar comillas dobles: (ej. si la oracion ya contiende una comilla simple "'
")
$ trans :zh "Life's but a walking shadow, a poor player"
Translate Shell muestra por defecto la palabra seguida de su traduccion. Si solo desea ver la traduccion, esta disponible una opcion rapida llamada -brief
(-b
):
$ trans -b :fr "Saluton, Mondo"
En el modo rapido, la forma fonetica de la palabra no se muestra. para habilitarla debe colocar el signo "@
" antes del codigo del lenguaje:
$ trans -b :@ja "Saluton, Mondo"
Google Translate can be used as a dictionary. When translating a word and the target language is the same as the source language, the dictionary entry of the word is shown:
$ trans :en word
To enable dictionary mode no matter whether the source language and the target language are identical, use the -dictionary
(-d
) option.
$ trans -d fr: mot
Note: Not every language supported by Google Translate has provided dictionary data. See wiki: Languages to find out which language(s) has dictionary support.
Use the -identify
(-id
) option to identify the language of the text:
$ trans -id 言葉
Use the -play
(-p
) option to listen to the translation:
$ trans -b -p :ja "Saluton, Mondo"
Use the -speak
(-sp
) option to listen to the original text:
$ trans -sp "你好,世界"
Sometimes the content of translation can be too much for display in one screen. Use the -view
(-v
) option to view the translation in a terminal pager such as less
or more
:
$ trans -d -v word
Right-to-Left (RTL) languages are well supported via GNU FriBidi.
The program will automatically adjust the screen width for padding when displaying right-to-left languages. Alternatively, you may use the -width
(-w
) option to specify the screen width:
$ trans -b -w 40 :he "Saluton, Mondo"
See wiki: Languages to find out which language(s) uses a Right-to-Left writing system.
If no source text is given in command-line arguments, the program will read from standard input, or from the file specified by the -input
(-i
) option:
$ echo "Saluton, Mondo" | trans -b :fr
$ trans -b -i input.txt :fr
Translations are written to standard output, or to the file specified by the -output
(-o
) option:
$ echo "Saluton, Mondo" | trans -b -o output.txt :fr
Instead of using the -input
option, a file URI scheme (file://
followed by the file name) can be used as a command-line argument:
$ trans :fr file://input.txt
Note: Brief mode is used when translating from file URI schemes.
To translate a web page, an http(s) URI scheme can be used as an argument:
$ trans :fr http://www.w3.org/
A browser session will open for viewing the translation (via Google Translate's web interface). To specify your web browser of choice, use the -browser
option:
$ trans -browser firefox :fr http://www.w3.org/
Use the -list
(-L
) option to view details of one or more languages:
$ trans -L fr
$ trans -L de+en
Some basic information of the language will be displayed: its English name and endonym (language name in the language itself), language family, writing system, canonical Google Translate code and ISO 639-3 code.
Start an interactive shell using the -shell
(or -interactive
, -I
) option:
$ trans -shell
You may specify the source language and the target language(s) before starting an interactive shell:
$ trans -shell en:fr
You may also change these settings during an interactive session. See wiki: REPL for more advanced usage of the interactive Translate Shell.
For more details on command-line options, see the man page trans(1) or use trans -M
in a terminal.
Usage: trans [OPTIONS] [SOURCE]:[TARGETS] [TEXT]...
Information options:
-V, -version
Print version and exit.
-H, -help
Print help message and exit.
-M, -man
Show man page and exit.
-T, -reference
Print reference table of languages and exit.
-R, -reference-english
Print reference table of languages (in English names) and exit.
-L CODES, -list CODES
Print details of languages and exit.
-S, -list-engines
List available translation engines and exit.
-U, -upgrade
Check for upgrade of this program.
Translator options:
-e ENGINE, -engine ENGINE
Specify the translation engine to use.
Display options:
-verbose
Verbose mode. (default)
-b, -brief
Brief mode.
-d, -dictionary
Dictionary mode.
-identify
Language identification.
-show-original Y/n
Show original text or not.
-show-original-phonetics Y/n
Show phonetic notation of original text or not.
-show-translation Y/n
Show translation or not.
-show-translation-phonetics Y/n
Show phonetic notation of translation or not.
-show-prompt-message Y/n
Show prompt message or not.
-show-languages Y/n
Show source and target languages or not.
-show-original-dictionary y/N
Show dictionary entry of original text or not.
-show-dictionary Y/n
Show dictionary entry of translation or not.
-show-alternatives Y/n
Show alternative translations or not.
-w NUM, -width NUM
Specify the screen width for padding.
-indent NUM
Specify the size of indent (number of spaces).
-theme FILENAME
Specify the theme to use.
-no-theme
Do not use any other theme than default.
-no-ansi
Do not use ANSI escape codes.
-no-autocorrect
Do not autocorrect. (if defaulted by the translation engine)
-no-bidi
Do not convert bidirectional texts.
-no-warn
Do not write warning messages to stderr.
-dump
Print raw API response instead.
Audio options:
-p, -play
Listen to the translation.
-speak
Listen to the original text.
-n VOICE, -narrator VOICE
Specify the narrator, and listen to the translation.
-player PROGRAM
Specify the audio player to use, and listen to the translation.
-no-play
Do not listen to the translation.
-no-translate
Do not translate anything when using -speak.
-download-audio
Download the audio to the current directory.
-download-audio-as FILENAME
Download the audio to the specified file.
Terminal paging and browsing options:
-v, -view
View the translation in a terminal pager.
-pager PROGRAM
Specify the terminal pager to use, and view the translation.
-no-view
Do not view the translation in a terminal pager.
-browser PROGRAM
Specify the web browser to use.
Networking options:
-x HOST:PORT, -proxy HOST:PORT
Use HTTP proxy on given port.
-u STRING, -user-agent STRING
Specify the User-Agent to identify as.
Interactive shell options:
-I, -interactive, -shell
Start an interactive shell.
-E, -emacs
Start the GNU Emacs front-end for an interactive shell.
-no-rlwrap
Do not invoke rlwrap when starting an interactive shell.
I/O options:
-i FILENAME, -input FILENAME
Specify the input file.
-o FILENAME, -output FILENAME
Specify the output file.
Language preference options:
-l CODE, -hl CODE, -lang CODE
Specify your home language.
-s CODE, -sl CODE, -source CODE, -from CODE
Specify the source language.
-t CODES, -tl CODE, -target CODES, -to CODES
Specify the target language(s), joined by '+'.
Other options:
-no-init
Do not load any initialization script.
See the man page trans(1) for more information.
Use trans -R
or trans -T
to view the reference table in a terminal.
For more details on languages and corresponding codes, see wiki: Languages.
Language | Code | Language | Code | Language | Code |
---|---|---|---|---|---|
Afrikaans Afrikaans |
af |
Hindi हिन्दी |
hi |
Punjabi ਪੰਜਾਬੀ |
pa |
Albanian Shqip |
sq |
Hmong Hmoob |
hmn |
Querétaro Otomi Hñąñho |
otq |
Amharic አማርኛ |
am |
Hmong Daw Hmoob Daw |
mww |
Romanian Română |
ro |
Arabic العربية |
ar |
Hungarian Magyar |
hu |
Russian Русский |
ru |
Armenian Հայերեն |
hy |
Icelandic Íslenska |
is |
Samoan Gagana Sāmoa |
sm |
Azerbaijani Azərbaycanca |
az |
Igbo Igbo |
ig |
Scots Gaelic Gàidhlig |
gd |
Basque Euskara |
eu |
Indonesian Bahasa Indonesia |
id |
Serbian (Cyrillic) српски |
sr-Cyrl |
Belarusian беларуская |
be |
Irish Gaeilge |
ga |
Serbian (Latin) srpski |
sr-Latn |
Bengali বাংলা |
bn |
Italian Italiano |
it |
Sesotho Sesotho |
st |
Bosnian Bosanski |
bs |
Japanese 日本語 |
ja |
Shona chiShona |
sn |
Bulgarian български |
bg |
Javanese Basa Jawa |
jv |
Sindhi سنڌي |
sd |
Cantonese 粵語 |
yue |
Kannada ಕನ್ನಡ |
kn |
Sinhala සිංහල |
si |
Catalan Català |
ca |
Kazakh Қазақ тілі |
kk |
Slovak Slovenčina |
sk |
Cebuano Cebuano |
ceb |
Khmer ភាសាខ្មែរ |
km |
Slovenian Slovenščina |
sl |
Chichewa Nyanja |
ny |
Klingon tlhIngan Hol |
tlh |
Somali Soomaali |
so |
Chinese Simplified 简体中文 |
zh-CN |
Klingon (pIqaD) |
tlh-Qaak |
Spanish Español |
es |
Chinese Traditional 正體中文 |
zh-TW |
Korean 한국어 |
ko |
Sundanese Basa Sunda |
su |
Corsican Corsu |
co |
Kurdish Kurdî |
ku |
Swahili Kiswahili |
sw |
Croatian Hrvatski |
hr |
Kyrgyz Кыргызча |
ky |
Swedish Svenska |
sv |
Czech Čeština |
cs |
Lao ລາວ |
lo |
Tahitian Reo Tahiti |
ty |
Danish Dansk |
da |
Latin Latina |
la |
Tajik Тоҷикӣ |
tg |
Dutch Nederlands |
nl |
Latvian Latviešu |
lv |
Tamil தமிழ் |
ta |
English English |
en |
Lithuanian Lietuvių |
lt |
Tatar татарча |
tt |
Esperanto Esperanto |
eo |
Luxembourgish Lëtzebuergesch |
lb |
Telugu తెలుగు |
te |
Estonian Eesti |
et |
Macedonian Македонски |
mk |
Thai ไทย |
th |
Fijian Vosa Vakaviti |
fj |
Malagasy Malagasy |
mg |
Tongan Lea faka-Tonga |
to |
Filipino Tagalog |
tl |
Malay Bahasa Melayu |
ms |
Turkish Türkçe |
tr |
Finnish Suomi |
fi |
Malayalam മലയാളം |
ml |
Udmurt удмурт |
udm |
French Français |
fr |
Maltese Malti |
mt |
Ukrainian Українська |
uk |
Frisian Frysk |
fy |
Maori Māori |
mi |
Urdu اُردُو |
ur |
Galician Galego |
gl |
Marathi मराठी |
mr |
Uzbek Oʻzbek tili |
uz |
Georgian ქართული |
ka |
Mongolian Монгол |
mn |
Vietnamese Tiếng Việt |
vi |
German Deutsch |
de |
Myanmar မြန်မာစာ |
my |
Welsh Cymraeg |
cy |
Greek Ελληνικά |
el |
Nepali नेपाली |
ne |
Xhosa isiXhosa |
xh |
Gujarati ગુજરાતી |
gu |
Norwegian Norsk |
no |
Yiddish ייִדיש |
yi |
Haitian Creole Kreyòl Ayisyen |
ht |
Pashto پښتو |
ps |
Yoruba Yorùbá |
yo |
Hausa Hausa |
ha |
Persian فارسی |
fa |
Yucatec Maya Màaya T'àan |
yua |
Hawaiian ʻŌlelo Hawaiʻi |
haw |
Polish Polski |
pl |
Zulu isiZulu |
zu |
Hebrew עִבְרִית |
he |
Portuguese Português |
pt |
Lists of all languages, writing systems and fonts for reference:
The following pages demonstrate the advanced usage of Translate Shell:
Find out whether your Linux distribution has included Translate Shell in its official repository. If not, contribute one:
Frequently Asked Questions, historical stuff, AWK coding style, etc.:
Please review the guidelines for contributing before reporting an issue or sending a pull request.
This is free and unencumbered software released into the public domain. See LICENSE and WAIVER for details.