Hello community, here is the log from the commit of package translate-shell for openSUSE:Factory checked in at 2015-11-24 22:33:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/translate-shell (Old) and /work/SRC/openSUSE:Factory/.translate-shell.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "translate-shell" Changes: -------- --- /work/SRC/openSUSE:Factory/translate-shell/translate-shell.changes 2015-10-14 16:44:53.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.translate-shell.new/translate-shell.changes 2015-11-24 22:34:21.000000000 +0100 @@ -1,0 +2,9 @@ +Mon Nov 23 20:34:07 UTC 2015 - [email protected] + +- Update to 0.9.1: + * Fix play() with placeholder parameter "&tk". + * Add -speak and -identify options. + * Allow names and endonyms as language aliases. + * -i will nowt fail if input file was not found. + +------------------------------------------------------------------- Old: ---- translate-shell-0.9.0.9.tar.gz New: ---- translate-shell-0.9.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ translate-shell.spec ++++++ --- /var/tmp/diff_new_pack.aQp2dl/_old 2015-11-24 22:34:22.000000000 +0100 +++ /var/tmp/diff_new_pack.aQp2dl/_new 2015-11-24 22:34:22.000000000 +0100 @@ -17,7 +17,7 @@ Name: translate-shell -Version: 0.9.0.9 +Version: 0.9.1 Release: 0 Summary: Google Translate to serve as a command-line tool License: Unlicense @@ -49,7 +49,6 @@ make %{?_smp_mflags} %install -mkdir -p %{buildroot}%{_bindir} %make_install \ PREFIX=%{buildroot}%{_prefix} @@ -60,6 +59,6 @@ %defattr(-,root,root) %doc CONTRIBUTING.md DISCLAIMER LICENSE README.md WAIVER %{_bindir}/trans -%{_mandir}/man1/trans.1%{?ext_man} +%{_mandir}/man?/trans.?%{?ext_man} %changelog ++++++ translate-shell-0.9.0.9.tar.gz -> translate-shell-0.9.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/Makefile new/translate-shell-0.9.1/Makefile --- old/translate-shell-0.9.0.9/Makefile 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/Makefile 2015-11-08 09:38:14.000000000 +0100 @@ -30,7 +30,7 @@ [ "`$(BUILDDIR)/$(COMMAND) -b 忍者`" = 'Ninja' ] install: - @install $(BUILDDIR)/$(COMMAND) $(PREFIX)/bin/$(COMMAND) &&\ + @install -D $(BUILDDIR)/$(COMMAND) $(PREFIX)/bin/$(COMMAND) &&\ mkdir -p $(PREFIX)/share/man/man1 &&\ cp $(MANDIR)/$(COMMAND).1 $(PREFIX)/share/man/man1/$(COMMAND).1 &&\ echo "[OK] $(NAME) installed." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/include/Help.awk new/translate-shell-0.9.1/include/Help.awk --- old/translate-shell-0.9.0.9/include/Help.awk 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/include/Help.awk 2015-11-08 09:38:14.000000000 +0100 @@ -67,6 +67,8 @@ ins(2, "Brief mode.") RS \ ins(1, ansi("bold", "-d") ", " ansi("bold", "-dictionary")) RS \ ins(2, "Dictionary mode.") RS \ + ins(1, ansi("bold", "-identify")) RS \ + ins(2, "Language identification.") RS \ ins(1, ansi("bold", "-show-original ") ansi("underline", "Y/n")) RS \ ins(2, "Show original text or not.") RS \ ins(1, ansi("bold", "-show-original-phonetics ") ansi("underline", "Y/n")) RS \ @@ -99,6 +101,8 @@ RS "Audio options:" RS \ ins(1, ansi("bold", "-p, -play")) RS \ ins(2, "Listen to the translation.") RS \ + ins(1, ansi("bold", "-speak")) RS \ + ins(2, "Listen to the original text.") RS \ ins(1, ansi("bold", "-player ") ansi("underline", "PROGRAM")) RS \ ins(2, "Specify the audio player to use, and listen to the translation.") RS \ ins(1, ansi("bold", "-no-play")) RS \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/include/Languages.awk new/translate-shell-0.9.1/include/Languages.awk --- old/translate-shell-0.9.0.9/include/Languages.awk 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/include/Languages.awk 2015-11-08 09:38:14.000000000 +0100 @@ -1699,6 +1699,10 @@ # ISO 639-3 codes as aliases LocaleAlias[Locale[i]["iso"]] = i + + # Names and endonyms as aliases + LocaleAlias[tolower(Locale[i]["name"])] = i + LocaleAlias[tolower(Locale[i]["endonym"])] = i } # Other aliases @@ -1713,6 +1717,7 @@ LocaleAlias["sh"] = "sr" # Serbo-Croatian: default to Serbian LocaleAlias["zh"] = "zh-CN" # Chinese: default to Chinese Simplified LocaleAlias["zho"] = "zh-CN" + LocaleAlias["chinese"] = "zh-CN" # TODO: more aliases } @@ -1722,6 +1727,8 @@ return code else if (code in LocaleAlias) return LocaleAlias[code] + else if (tolower(code) in LocaleAlias) + return LocaleAlias[tolower(code)] else return # return nothing if not found } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/include/Main.awk new/translate-shell-0.9.1/include/Main.awk --- old/translate-shell-0.9.0.9/include/Main.awk 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/include/Main.awk 2015-11-08 09:38:14.000000000 +0100 @@ -246,6 +246,13 @@ continue } + # -identify + match(ARGV[pos], /^--?id(e(n(t(i(fy?)?)?)?)?)?$/) + if (RSTART) { + Option["verbose"] = -1 + continue + } + # -show-original Y/n match(ARGV[pos], /^--?show-original(=(.*)?)?$/, group) if (RSTART) { @@ -359,10 +366,17 @@ continue } + # -speak + match(ARGV[pos], /^--?sp(e(ak?)?)?$/) + if (RSTART) { + Option["play"] = 2 + continue + } + # -player PROGRAM match(ARGV[pos], /^--?player(=(.*)?)?$/, group) if (RSTART) { - Option["play"] = 1 + if (!Option["play"]) Option["play"] = 1 # -play by default Option["player"] = group[1] ? (group[2] ? group[2] : Option["player"]) : ARGV[++pos] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/include/Translate.awk new/translate-shell-0.9.1/include/Translate.awk --- old/translate-shell-0.9.0.9/include/Translate.awk 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/include/Translate.awk 2015-11-08 09:38:14.000000000 +0100 @@ -93,7 +93,7 @@ # Play using Google Text-to-Speech engine. function play(text, tl, url) { url = HttpProtocol HttpHost "/translate_tts?ie=UTF-8&client=t" \ - "&tl=" tl "&q=" preprocess(text) + "&tl=" tl "&tk" "&q=" preprocess(text) # Don't use getline from pipe here - the same pipe will be run only once for each AWK script! system(Option["player"] " " parameterize(url) SUPOUT SUPERR) @@ -101,7 +101,7 @@ # Get the translation of a string. function getTranslation(text, sl, tl, hl, - isVerbose, toSpeech, returnPlaylist, + isVerbose, toSpeech, returnPlaylist, returnIl, #### r, content, tokens, ast, @@ -215,7 +215,9 @@ translation = join(translations) - il = !anything(ils) || belongsTo(sl, ils) ? sl : ils[0] + returnIl[0] = il = !anything(ils) || belongsTo(sl, ils) ? sl : ils[0] + if (Option["verbose"] < 0) + return getList(il) # Generate output if (!isVerbose) { @@ -497,7 +499,7 @@ # Translate the source text (into all target languages). function translate(text, inline, #### - i, j, playlist, saveSortedIn) { + i, j, playlist, il, saveSortedIn) { if (!getCode(Option["hl"])) { # Check if home language is supported @@ -536,15 +538,21 @@ # translate URL only from command-line parameters (inline) webTranslation(text, Option["sl"], Option["tl"][i], Option["hl"]) } else { - p(getTranslation(text, Option["sl"], Option["tl"][i], Option["hl"], Option["verbose"], Option["play"], playlist)) + p(getTranslation(text, Option["sl"], Option["tl"][i], Option["hl"], Option["verbose"], Option["play"], playlist, il)) - if (Option["play"]) + if (Option["play"] == 1) { if (Option["player"]) for (j in playlist) play(playlist[j]["text"], playlist[j]["tl"]) else if (SpeechSynthesizer) for (j in playlist) print playlist[j]["text"] | SpeechSynthesizer + } else if (Option["play"] == 2) { + if (Option["player"]) + play(text, il[0]) + else if (SpeechSynthesizer) + print text | SpeechSynthesizer + } } } PROCINFO["sorted_in"] = saveSortedIn @@ -555,16 +563,22 @@ if (Option["interactive"]) prompt() - i = 0 - while (getline line < Option["input"]) { - # Non-interactive verbose mode: separator between sources - if (!Option["interactive"]) - if (Option["verbose"] && i++ > 0) - p(prettify("source-seperator", replicate(Option["chr-source-seperator"], Option["width"]))) - - if (Option["interactive"]) - repl(line) - else - translate(line) - } + if (Option["input"] == STDIN || fileExists(Option["input"])) { + i = 0 + while (getline line < Option["input"]) + if (line) { + # Non-interactive verbose mode: separator between sources + if (!Option["interactive"]) + if (Option["verbose"] && i++ > 0) + p(prettify("source-seperator", + replicate(Option["chr-source-seperator"], + Option["width"]))) + + if (Option["interactive"]) + repl(line) + else + translate(line) + } + } else + e("[ERROR] File not found: " Option["input"]) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/man/trans.1 new/translate-shell-0.9.1/man/trans.1 --- old/translate-shell-0.9.0.9/man/trans.1 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/man/trans.1 2015-11-08 09:38:14.000000000 +0100 @@ -1,4 +1,4 @@ -.TH "TRANS" "1" "2015\-10\-05" "0.9.0.9" "" +.TH "TRANS" "1" "2015\-11\-08" "0.9.1" "" .SH NAME .PP trans \- Google Translate served as a command\-line tool @@ -86,6 +86,13 @@ Show the definition of the original word in the dictionary. .RE .TP +.B \f[B]\-identify\f[] +Language identification. +.RS +.PP +Show the identified language of the original text. +.RE +.TP .B \f[B]\-show\-original\f[] \f[I]Y/n\f[] Show original text or not. (default: yes) @@ -184,6 +191,11 @@ on Mac OS X, \f[B]espeak\f[] on Linux or other platforms). .RE .TP +.B \f[B]\-speak\f[] +Listen to the original text. +.RS +.RE +.TP .B \f[B]\-player\f[] \f[I]PROGRAM\f[] Specify the audio player to use, and listen to the translation. .RS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/man/trans.1.md new/translate-shell-0.9.1/man/trans.1.md --- old/translate-shell-0.9.0.9/man/trans.1.md 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/man/trans.1.md 2015-11-08 09:38:14.000000000 +0100 @@ -1,6 +1,6 @@ -% TRANS(1) 0.9.0.9 +% TRANS(1) 0.9.1 % Mort Yao <[email protected]> -% 2015-10-05 +% 2015-11-08 # NAME @@ -62,6 +62,11 @@ Show the definition of the original word in the dictionary. +**-identify** +: Language identification. + + Show the identified language of the original text. + **-show-original** *Y/n* : Show original text or not. (default: yes) @@ -115,6 +120,9 @@ You must have at least one of the supported audio players (**mplayer**, **mpv** or **mpg123**) installed to stream from Google Text-to-Speech engine. Otherwise, a local speech synthesizer may be used instead (**say** on Mac OS X, **espeak** on Linux or other platforms). +**-speak** +: Listen to the original text. + **-player** *PROGRAM* : Specify the audio player to use, and listen to the translation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/man/trans.1.template.md new/translate-shell-0.9.1/man/trans.1.template.md --- old/translate-shell-0.9.0.9/man/trans.1.template.md 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/man/trans.1.template.md 2015-11-08 09:38:14.000000000 +0100 @@ -62,6 +62,11 @@ Show the definition of the original word in the dictionary. +**-identify** +: Language identification. + + Show the identified language of the original text. + **-show-original** *Y/n* : Show original text or not. (default: yes) @@ -115,6 +120,9 @@ You must have at least one of the supported audio players (**mplayer**, **mpv** or **mpg123**) installed to stream from Google Text-to-Speech engine. Otherwise, a local speech synthesizer may be used instead (**say** on Mac OS X, **espeak** on Linux or other platforms). +**-speak** +: Listen to the original text. + **-player** *PROGRAM* : Specify the audio player to use, and listen to the translation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/translate-shell-0.9.0.9/metainfo.awk new/translate-shell-0.9.1/metainfo.awk --- old/translate-shell-0.9.0.9/metainfo.awk 2015-10-05 13:43:45.000000000 +0200 +++ new/translate-shell-0.9.1/metainfo.awk 2015-11-08 09:38:14.000000000 +0100 @@ -1,8 +1,8 @@ BEGIN { Name = "Translate Shell" Description = "Google Translate to serve as a command-line tool" - Version = "0.9.0.9" - ReleaseDate = "2015-10-05" + Version = "0.9.1" + ReleaseDate = "2015-11-08" Command = "trans" EntryPoint = "translate.awk" }
