Hello community,

here is the log from the commit of package translate-shell for openSUSE:Factory 
checked in at 2015-12-29 13:00:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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-11-24 22:34:21.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.translate-shell.new/translate-shell.changes     
2015-12-29 13:00:25.000000000 +0100
@@ -1,0 +2,5 @@
+Tue Dec 29 05:32:40 UTC 2015 - [email protected]
+
+- Update to 0.9.2.1.
+
+-------------------------------------------------------------------

Old:
----
  translate-shell-0.9.1.tar.gz

New:
----
  translate-shell-0.9.2.1.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ translate-shell.spec ++++++
--- /var/tmp/diff_new_pack.j3fJWA/_old  2015-12-29 13:00:26.000000000 +0100
+++ /var/tmp/diff_new_pack.j3fJWA/_new  2015-12-29 13:00:26.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           translate-shell
-Version:        0.9.1
+Version:        0.9.2.1
 Release:        0
 Summary:        Google Translate to serve as a command-line tool
 License:        Unlicense

++++++ translate-shell-0.9.1.tar.gz -> translate-shell-0.9.2.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/Makefile 
new/translate-shell-0.9.2.1/Makefile
--- old/translate-shell-0.9.1/Makefile  2015-11-08 09:38:14.000000000 +0100
+++ new/translate-shell-0.9.2.1/Makefile        2015-12-18 13:17:01.000000000 
+0100
@@ -27,7 +27,8 @@
 
 check: test
        $(BUILDDIR)/$(COMMAND) -V
-       [ "`$(BUILDDIR)/$(COMMAND) -b 忍者`" = 'Ninja' ]
+       [ "`$(BUILDDIR)/$(COMMAND) -no-init -D -b 忍者`" = 'Ninja' ] &&\
+       [ "`$(BUILDDIR)/$(COMMAND) -no-init -D -b 'hello world'`" = 'hello 
world' ]
 
 install:
        @install -D $(BUILDDIR)/$(COMMAND) $(PREFIX)/bin/$(COMMAND) &&\
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/README.md 
new/translate-shell-0.9.2.1/README.md
--- old/translate-shell-0.9.1/README.md 2015-11-08 09:38:14.000000000 +0100
+++ new/translate-shell-0.9.2.1/README.md       2015-12-18 13:17:01.000000000 
+0100
@@ -232,12 +232,22 @@
 
 **Note:** Not every language supported by Google Translate has provided 
dictionary data. See **[wiki: 
Languages](https://github.com/soimort/translate-shell/wiki/Languages)** to find 
out which language(s) has dictionary support.
 
+### Language Identification
+
+Use the `-identify` (`-id`) option to identify the language of the text:
+
+    $ trans -id 言葉
+
 ### Text-to-Speech
 
 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 "你好,世界"
+
 ### Terminal Paging
 
 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`:
@@ -334,6 +344,8 @@
         Brief mode.
     -d, -dictionary
         Dictionary mode.
+    -identify
+        Language identification.
     -show-original Y/n
         Show original text or not.
     -show-original-phonetics Y/n
@@ -366,6 +378,8 @@
 Audio options:
     -p, -play
         Listen to the translation.
+    -speak
+        Listen to the original text.
     -player PROGRAM
         Specify the audio player to use, and listen to the translation.
     -no-play
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/README.template.md 
new/translate-shell-0.9.2.1/README.template.md
--- old/translate-shell-0.9.1/README.template.md        2015-11-08 
09:38:14.000000000 +0100
+++ new/translate-shell-0.9.2.1/README.template.md      2015-12-18 
13:17:01.000000000 +0100
@@ -232,12 +232,22 @@
 
 **Note:** Not every language supported by Google Translate has provided 
dictionary data. See **[wiki: 
Languages](https://github.com/soimort/translate-shell/wiki/Languages)** to find 
out which language(s) has dictionary support.
 
+### Language Identification
+
+Use the `-identify` (`-id`) option to identify the language of the text:
+
+    $ trans -id 言葉
+
 ### Text-to-Speech
 
 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 "你好,世界"
+
 ### Terminal Paging
 
 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`:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/include/GenTK.awk 
new/translate-shell-0.9.2.1/include/GenTK.awk
--- old/translate-shell-0.9.1/include/GenTK.awk 1970-01-01 01:00:00.000000000 
+0100
+++ new/translate-shell-0.9.2.1/include/GenTK.awk       2015-12-18 
13:17:01.000000000 +0100
@@ -0,0 +1,46 @@
+####################################################################
+# GenTK.awk                                                        #
+####################################################################
+#
+# Last Updated: 18 Dec 2015
+# 
https://translate.google.com/translate/releases/twsfe_w_20151214_RC03/r/js/desktop_module_main.js
+
+function genRL(a, x,
+               ####
+               b, c, d, i, y) {
+    tokenize(y, x)
+    parseList(b, y)
+    i = SUBSEP 0
+    for (c = 0; c < length(b[i]) - 2; c += 3) {
+        d = b[i][c + 2]
+        d = d >= 97 ? d - 87 :
+            d - 48 # convert to number
+        d = b[i][c + 1] == 43 ? rshift(a, d) : lshift(a, d)
+        a = b[i][c] == 43 ? and(a + d, 4294967295) : xor(a, d)
+    }
+    return a
+}
+
+function genTK(text,
+               ####
+               a, d, dLen, e, tkk, ub, vb) {
+    if (TK[text]) return TK[text]
+
+    tkk = systime() / 3600
+    ub = "[43,45,51,94,43,98,43,45,102]"
+    vb = "[43,45,97,94,43,54]"
+
+    dLen = dump(text, d) # convert to byte array
+    a = tkk
+    for (e = 1; e <= dLen; e++)
+        a = genRL(a + d[e], vb)
+    a = genRL(a, ub)
+    0 > a && (a = and(a, 2147483647) + 2147483648)
+    a %= 1e6
+    TK[text] = a "." xor(a, tkk)
+
+    l(text, "text")
+    l(tkk, "tkk")
+    l(TK[text], "tk")
+    return TK[text]
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/include/Main.awk 
new/translate-shell-0.9.2.1/include/Main.awk
--- old/translate-shell-0.9.1/include/Main.awk  2015-11-08 09:38:14.000000000 
+0100
+++ new/translate-shell-0.9.2.1/include/Main.awk        2015-12-18 
13:17:01.000000000 +0100
@@ -150,6 +150,7 @@
 
     # Command-line options override initialization script
     pos = 0
+    noargc = 0
     while (ARGV[++pos]) {
         ## Information options
 
@@ -569,7 +570,8 @@
             break # no more option from here
         }
 
-        break # no more option from here
+        # non-option argument
+        noargv[noargc++] = ARGV[pos]
     }
 
     # Handle interactive shell
@@ -616,22 +618,23 @@
     if (Option["interactive"])
         welcome()
 
-    if (pos < ARGC) {
-        # More parameters
-
-        # Translate remaining parameters
-        for (i = pos; i < ARGC; i++) {
+    # More remaining non-option arguments
+    if (pos < ARGC)
+        for (i = pos; i < ARGC; i++)
+            noargv[noargc++] = ARGV[i]
+
+    if (noargc) {
+        # Translate all non-option arguments
+        for (i = 0; i < noargc; i++) {
             # Verbose mode: separator between sources
             if (Option["verbose"] && i > pos)
                 p(prettify("source-seperator", 
replicate(Option["chr-source-seperator"], Option["width"])))
 
-            translate(ARGV[i], 1) # inline mode
+            translate(noargv[i], 1) # inline mode
         }
 
         # If input not specified, we're done
     } else {
-        # No more parameter besides options
-
         # If input not specified, use stdin
         if (!Option["input"]) Option["input"] = STDIN
     }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/include/Translate.awk 
new/translate-shell-0.9.2.1/include/Translate.awk
--- old/translate-shell-0.9.1/include/Translate.awk     2015-11-08 
09:38:14.000000000 +0100
+++ new/translate-shell-0.9.2.1/include/Translate.awk   2015-12-18 
13:17:01.000000000 +0100
@@ -65,7 +65,8 @@
     url = HttpPathPrefix "/translate_a/single?client=t"                 \
         "&ie=UTF-8&oe=UTF-8"                                            \
         "&dt=bd&dt=ex&dt=ld&dt=md&dt=qca&dt=rw&dt=rm&dt=ss&dt=t&dt=at"  \
-        "&q=" preprocess(text) "&sl=" sl "&tl=" tl "&hl=" hl "&tk"
+        "&sl=" sl "&tl=" tl "&hl=" hl                                   \
+        "&tk=" genTK(text) "&q=" preprocess(text)
     header = "GET " url " HTTP/1.1\n"           \
         "Host: " HttpHost "\n"                  \
         "Connection: close\n"
@@ -93,7 +94,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 "&tk" "&q=" preprocess(text)
+        "&tl=" tl "&tk=" genTK(text) "&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)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/include/Utils.awk 
new/translate-shell-0.9.2.1/include/Utils.awk
--- old/translate-shell-0.9.1/include/Utils.awk 2015-11-08 09:38:14.000000000 
+0100
+++ new/translate-shell-0.9.2.1/include/Utils.awk       2015-12-18 
13:17:01.000000000 +0100
@@ -153,3 +153,15 @@
         return content
     }
 }
+
+# Dump a Unicode string into a byte array. Return the length of the array.
+# NOTE: can only be ran once for each text! Build a cache.
+function dump(text, group,    command, temp) {
+    # hexdump tricks:
+    # (1) use -v (--no-squeezing)
+    # (2) use "%u" (unsigned integers)
+    command = "hexdump" " -v -e'1/1 \"%03u\" \" \"'"
+    ("echo " parameterize(text) PIPE command) | getline temp
+    split(temp, group, " ")
+    return length(group) - 1
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/man/trans.1 
new/translate-shell-0.9.2.1/man/trans.1
--- old/translate-shell-0.9.1/man/trans.1       2015-11-08 09:38:14.000000000 
+0100
+++ new/translate-shell-0.9.2.1/man/trans.1     2015-12-18 13:17:01.000000000 
+0100
@@ -1,4 +1,7 @@
-.TH "TRANS" "1" "2015\-11\-08" "0.9.1" ""
+.\" Automatically generated by Pandoc 1.15.2.1
+.\"
+.hy
+.TH "TRANS" "1" "2015\-12\-18" "0.9.2.1" ""
 .SH NAME
 .PP
 trans \- Google Translate served as a command\-line tool
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/man/trans.1.md 
new/translate-shell-0.9.2.1/man/trans.1.md
--- old/translate-shell-0.9.1/man/trans.1.md    2015-11-08 09:38:14.000000000 
+0100
+++ new/translate-shell-0.9.2.1/man/trans.1.md  2015-12-18 13:17:01.000000000 
+0100
@@ -1,6 +1,6 @@
-% TRANS(1) 0.9.1
+% TRANS(1) 0.9.2.1
 % Mort Yao <[email protected]>
-% 2015-11-08
+% 2015-12-18
 
 # NAME
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/metainfo.awk 
new/translate-shell-0.9.2.1/metainfo.awk
--- old/translate-shell-0.9.1/metainfo.awk      2015-11-08 09:38:14.000000000 
+0100
+++ new/translate-shell-0.9.2.1/metainfo.awk    2015-12-18 13:17:01.000000000 
+0100
@@ -1,8 +1,8 @@
 BEGIN {
     Name        = "Translate Shell"
     Description = "Google Translate to serve as a command-line tool"
-    Version     = "0.9.1"
-    ReleaseDate = "2015-11-08"
+    Version     = "0.9.2.1"
+    ReleaseDate = "2015-12-18"
     Command     = "trans"
     EntryPoint  = "translate.awk"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/test/TestUtils.awk 
new/translate-shell-0.9.2.1/test/TestUtils.awk
--- old/translate-shell-0.9.1/test/TestUtils.awk        2015-11-08 
09:38:14.000000000 +0100
+++ new/translate-shell-0.9.2.1/test/TestUtils.awk      2015-12-18 
13:17:01.000000000 +0100
@@ -30,5 +30,17 @@
         assertTrue(newerVersion("2", "1.9.9999"))
     }
 
+    T("dump()", 3)
+    {
+        delete group
+        assertEqual(dump("a", group), 1)
+
+        delete group
+        assertEqual(dump("Århus", group), 6)
+
+        delete group
+        assertEqual(dump("안녕하세요 세계", group), 22)
+    }
+
     END_TEST()
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/translate-shell-0.9.1/translate.awk 
new/translate-shell-0.9.2.1/translate.awk
--- old/translate-shell-0.9.1/translate.awk     2015-11-08 09:38:14.000000000 
+0100
+++ new/translate-shell-0.9.2.1/translate.awk   2015-12-18 13:17:01.000000000 
+0100
@@ -5,6 +5,8 @@
 @include "include/Commons"
 @include "include/Utils"
 
+@include "include/GenTK"
+
 @include "include/Languages"
 @include "include/Help"
 @include "include/Parser"


Reply via email to