alex2222222

GENERADOR-NEW-ULTIMATE-ORIGINAL/master/Install/trans

Mar 31st, 2019
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 194.02 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. exec 2>/dev/null
  3. export TRANS_ENTRY="$0"
  4. if [[ ! $LANG =~ (UTF|utf)-?8$ ]]; then export LANG=en_US.UTF-8; fi
  5. read -r -d '' TRANS_PROGRAM << 'EOF'
  6. BEGIN {
  7. Name = "Translate Shell"
  8. Description = "Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc."
  9. Version = "0.9.6.7"
  10. ReleaseDate = "2018-03-17"
  11. Command = "trans"
  12. EntryPoint = "translate.awk"
  13. EntryScript = "translate"
  14. }
  15. function initConst() {
  16. NULLSTR = ""
  17. TRUE = 1
  18. STDIN = "/dev/stdin"
  19. STDOUT = "/dev/stdout"
  20. STDERR = "/dev/stderr"
  21. SUPOUT = " > /dev/null "
  22. SUPERR = " 2> /dev/null "
  23. PIPE = " | "
  24. }
  25. function anything(array,
  26. i) {
  27. for (i in array)
  28. if (array[i]) return 1
  29. return 0
  30. }
  31. function exists(value) {
  32. if (isarray(value))
  33. return anything(value)
  34. else
  35. return value ? 1 : 0
  36. }
  37. function belongsTo(element, array,
  38. i) {
  39. for (i in array)
  40. if (element == array[i]) return element
  41. return NULLSTR
  42. }
  43. function identical(x, y,
  44. i) {
  45. if (!isarray(x) && !isarray(y))
  46. return x == y
  47. else if (isarray(x) && isarray(y)) {
  48. if (length(x) != length(y)) return 0
  49. for (i in x)
  50. if (!identical(x[i], y[i])) return 0
  51. return 1
  52. } else
  53. return 0
  54. }
  55. function append(array, element) {
  56. array[anything(array) ? length(array) : 0] = element
  57. }
  58. function compareByIndexFields(i1, v1, i2, v2,
  59. t1, t2, tl, j) {
  60. split(i1, t1, SUBSEP)
  61. split(i2, t2, SUBSEP)
  62. tl = length(t1) < length(t2) ? length(t1) : length(t2)
  63. for (j = 1; j <= tl; j++) {
  64. if (t1[j] < t2[j])
  65. return -1
  66. else if (t1[j] > t2[j])
  67. return 1
  68. }
  69. return 0
  70. }
  71. function isnum(string) {
  72. return string == string + 0
  73. }
  74. function startsWithAny(string, substrings,
  75. i) {
  76. for (i in substrings)
  77. if (index(string, substrings[i]) == 1) return substrings[i]
  78. return NULLSTR
  79. }
  80. function matchesAny(string, patterns,
  81. i) {
  82. for (i in patterns)
  83. if (string ~ "^" patterns[i]) return patterns[i]
  84. return NULLSTR
  85. }
  86. function replicate(string, len,
  87. i, temp) {
  88. temp = NULLSTR
  89. for (i = 0; i < len; i++)
  90. temp = temp string
  91. return temp
  92. }
  93. function reverse(string,
  94. i, temp) {
  95. temp = NULLSTR
  96. for (i = length(string); i > 0; i--)
  97. temp = temp substr(string, i, 1);
  98. return temp
  99. }
  100. function join(array, separator, sortedIn, preserveNull,
  101. i, j, saveSortedIn, temp) {
  102. if (!sortedIn)
  103. sortedIn = "compareByIndexFields"
  104. temp = NULLSTR
  105. j = 0
  106. if (isarray(array)) {
  107. saveSortedIn = PROCINFO["sorted_in"]
  108. PROCINFO["sorted_in"] = sortedIn
  109. for (i in array)
  110. if (preserveNull || array[i] != NULLSTR)
  111. temp = j++ ? temp separator array[i] : array[i]
  112. PROCINFO["sorted_in"] = saveSortedIn
  113. } else
  114. temp = array
  115. return temp
  116. }
  117. function explode(string, array) {
  118. split(string, array, NULLSTR)
  119. }
  120. function escapeChar(char) {
  121. switch (char) {
  122. case "b":
  123. return "\b"
  124. case "f":
  125. return "\f"
  126. case "n":
  127. return "\n"
  128. case "r":
  129. return "\r"
  130. case "t":
  131. return "\t"
  132. case "v":
  133. return "\v"
  134. case "u0026":
  135. return "&"
  136. case "u003c":
  137. return "<"
  138. case "u003e":
  139. return ">"
  140. default:
  141. return char
  142. }
  143. }
  144. function literal(string,
  145. c, cc, escaping, i, s) {
  146. if (string !~ /^".*"$/)
  147. return string
  148. explode(string, s)
  149. string = NULLSTR
  150. escaping = 0
  151. for (i = 2; i < length(s); i++) {
  152. c = s[i]
  153. if (escaping) {
  154. if (cc) {
  155. cc = cc c
  156. if (length(cc) == 5) {
  157. string = string escapeChar(cc)
  158. escaping = 0
  159. cc = NULLSTR
  160. }
  161. } else if (c == "u") {
  162. cc = c
  163. } else {
  164. string = string escapeChar(c)
  165. escaping = 0
  166. }
  167. } else {
  168. if (c == "\\")
  169. escaping = 1
  170. else
  171. string = string c
  172. }
  173. }
  174. return string
  175. }
  176. function escape(string) {
  177. gsub(/\\/, "\\\\", string)
  178. gsub(/"/, "\\\"", string)
  179. return string
  180. }
  181. function unescape(string) {
  182. gsub(/\\\"/, "\"", string)
  183. gsub(/\\\\/, "\\", string)
  184. return string
  185. }
  186. function parameterize(string, quotationMark) {
  187. if (!quotationMark)
  188. quotationMark = "'"
  189. if (quotationMark == "'") {
  190. gsub(/'/, "'\\''", string)
  191. return "'" string "'"
  192. } else {
  193. return "\"" escape(string) "\""
  194. }
  195. }
  196. function unparameterize(string, temp) {
  197. match(string, /^'(.*)'$/, temp)
  198. if (temp[0]) {
  199. string = temp[1]
  200. gsub(/'\\''/, "'", string)
  201. return string
  202. }
  203. match(string, /^"(.*)"$/, temp)
  204. if (temp[0]) {
  205. string = temp[1]
  206. return unescape(string)
  207. }
  208. return string
  209. }
  210. function toString(value, inline, heredoc, valOnly, numSub, level, sortedIn,
  211. i, items, j, k, p, saveSortedIn, temp, v) {
  212. if (!level) level = 0
  213. if (!sortedIn)
  214. sortedIn = "compareByIndexFields"
  215. if (isarray(value)) {
  216. saveSortedIn = PROCINFO["sorted_in"]
  217. PROCINFO["sorted_in"] = sortedIn
  218. p = 0
  219. for (i in value) {
  220. split(i, j, SUBSEP); k = join(j, ",")
  221. if (!numSub || !isnum(k)) k = parameterize(k, "\"")
  222. v = toString(value[i], inline, heredoc, valOnly, numSub, level + 1, sortedIn)
  223. if (!isarray(value[i])) v = parameterize(v, "\"")
  224. if (valOnly)
  225. items[p++] = inline ? v : (replicate("\t", level) v)
  226. else
  227. items[p++] = inline ? (k ": " v) :
  228. (replicate("\t", level) k "\t" v)
  229. }
  230. PROCINFO["sorted_in"] = saveSortedIn
  231. temp = inline ? join(items, ", ") :
  232. ("\n" join(items, "\n") "\n" replicate("\t", level))
  233. temp = valOnly ? ("[" temp "]") : ("{" temp "}")
  234. return temp
  235. } else {
  236. if (heredoc)
  237. return "'''\n" value "\n'''"
  238. else
  239. return value
  240. }
  241. }
  242. function squeeze(line, preserveIndent) {
  243. if (!preserveIndent)
  244. gsub(/^[[:space:]]+/, NULLSTR, line)
  245. gsub(/^[[:space:]]*#.*$/, NULLSTR, line)
  246. gsub(/#[^"/]*$/, NULLSTR, line)
  247. gsub(/[[:space:]]+$/, NULLSTR, line)
  248. gsub(/[[:space:]]+\\$/, "\\", line)
  249. return line
  250. }
  251. function yn(string) {
  252. return (tolower(string) ~ /^([0fn]|off)/) ? 0 : 1
  253. }
  254. function initAnsiCode() {
  255. if (ENVIRON["TERM"] == "dumb") return
  256. AnsiCode["reset"] = AnsiCode[0] = "\33[0m"
  257. AnsiCode["bold"] = "\33[1m"
  258. AnsiCode["underline"] = "\33[4m"
  259. AnsiCode["negative"] = "\33[7m"
  260. AnsiCode["no bold"] = "\33[22m"
  261. AnsiCode["no underline"] = "\33[24m"
  262. AnsiCode["positive"] = "\33[27m"
  263. AnsiCode["black"] = "\33[30m"
  264. AnsiCode["red"] = "\33[31m"
  265. AnsiCode["green"] = "\33[32m"
  266. AnsiCode["yellow"] = "\33[33m"
  267. AnsiCode["blue"] = "\33[34m"
  268. AnsiCode["magenta"] = "\33[35m"
  269. AnsiCode["cyan"] = "\33[36m"
  270. AnsiCode["gray"] = "\33[37m"
  271. AnsiCode["default"] = "\33[39m"
  272. AnsiCode["dark gray"] = "\33[90m"
  273. AnsiCode["light red"] = "\33[91m"
  274. AnsiCode["light green"] = "\33[92m"
  275. AnsiCode["light yellow"] = "\33[93m"
  276. AnsiCode["light blue"] = "\33[94m"
  277. AnsiCode["light magenta"] = "\33[95m"
  278. AnsiCode["light cyan"] = "\33[96m"
  279. AnsiCode["white"] = "\33[97m"
  280. }
  281. function ansi(code, text) {
  282. switch (code) {
  283. case "bold":
  284. return AnsiCode[code] text AnsiCode["no bold"]
  285. case "underline":
  286. return AnsiCode[code] text AnsiCode["no underline"]
  287. case "negative":
  288. return AnsiCode[code] text AnsiCode["positive"]
  289. default:
  290. return AnsiCode[code] text AnsiCode[0]
  291. }
  292. }
  293. function w(text) {
  294. print ansi("yellow", text) > STDERR
  295. }
  296. function e(text) {
  297. print ansi("bold", ansi("yellow", text)) > STDERR
  298. }
  299. function wtf(text) {
  300. print ansi("bold", ansi("red", text)) > STDERR
  301. }
  302. function d(text) {
  303. print ansi("gray", text) > STDERR
  304. }
  305. function da(value, name, inline, heredoc, valOnly, numSub, sortedIn,
  306. i, j, saveSortedIn) {
  307. if (!name)
  308. name = "_"
  309. if (!sortedIn)
  310. sortedIn = "compareByIndexFields"
  311. d(name " = " toString(value, inline, heredoc, valOnly, numSub, 0, sortedIn))
  312. }
  313. function assert(x, message) {
  314. if (!message)
  315. message = "[ERROR] Assertion failed."
  316. if (x)
  317. return x
  318. else
  319. e(message)
  320. }
  321. function initUrlEncoding() {
  322. UrlEncoding["\t"] = "%09"
  323. UrlEncoding["\n"] = "%0A"
  324. UrlEncoding[" "] = "%20"
  325. UrlEncoding["!"] = "%21"
  326. UrlEncoding["\""] = "%22"
  327. UrlEncoding["#"] = "%23"
  328. UrlEncoding["$"] = "%24"
  329. UrlEncoding["%"] = "%25"
  330. UrlEncoding["&"] = "%26"
  331. UrlEncoding["'"] = "%27"
  332. UrlEncoding["("] = "%28"
  333. UrlEncoding[")"] = "%29"
  334. UrlEncoding["*"] = "%2A"
  335. UrlEncoding["+"] = "%2B"
  336. UrlEncoding[","] = "%2C"
  337. UrlEncoding["-"] = "%2D"
  338. UrlEncoding["."] = "%2E"
  339. UrlEncoding["/"] = "%2F"
  340. UrlEncoding[":"] = "%3A"
  341. UrlEncoding[";"] = "%3B"
  342. UrlEncoding["<"] = "%3C"
  343. UrlEncoding["="] = "%3D"
  344. UrlEncoding[">"] = "%3E"
  345. UrlEncoding["?"] = "%3F"
  346. UrlEncoding["@"] = "%40"
  347. UrlEncoding["["] = "%5B"
  348. UrlEncoding["\\"] = "%5C"
  349. UrlEncoding["]"] = "%5D"
  350. UrlEncoding["^"] = "%5E"
  351. UrlEncoding["_"] = "%5F"
  352. UrlEncoding["`"] = "%60"
  353. UrlEncoding["{"] = "%7B"
  354. UrlEncoding["|"] = "%7C"
  355. UrlEncoding["}"] = "%7D"
  356. UrlEncoding["~"] = "%7E"
  357. }
  358. function quote(string, i, r, s) {
  359. r = NULLSTR
  360. explode(string, s)
  361. for (i = 1; i <= length(s); i++)
  362. r = r (s[i] in UrlEncoding ? UrlEncoding[s[i]] : s[i])
  363. return r
  364. }
  365. function unquote(string, i, k, r, s, temp) {
  366. r = NULLSTR
  367. explode(string, s)
  368. temp = NULLSTR
  369. for (i = 1; i <= length(s); i++)
  370. if (temp) {
  371. temp = temp s[i]
  372. if (length(temp) > 2) {
  373. for (k in UrlEncoding)
  374. if (temp == UrlEncoding[k]) {
  375. r = r k
  376. temp = NULLSTR
  377. break
  378. }
  379. if (temp) {
  380. r = r temp
  381. temp = NULLSTR
  382. }
  383. }
  384. } else {
  385. if (s[i] != "%")
  386. r = r s[i]
  387. else
  388. temp = s[i]
  389. }
  390. if (temp)
  391. r = r temp
  392. return r
  393. }
  394. function initUriSchemes() {
  395. UriSchemes[0] = "file://"
  396. UriSchemes[1] = "http://"
  397. UriSchemes[2] = "https://"
  398. }
  399. function readFrom(file, line, text) {
  400. if (!file) file = "/dev/stdin"
  401. text = NULLSTR
  402. while (getline line < file)
  403. text = (text ? text "\n" : NULLSTR) line
  404. return text
  405. }
  406. function writeTo(text, file) {
  407. if (!file) file = "/dev/stdout"
  408. print text > file
  409. }
  410. function getOutput(command, content, line) {
  411. content = NULLSTR
  412. while ((command |& getline line) > 0)
  413. content = (content ? content "\n" : NULLSTR) line
  414. return content
  415. }
  416. function fileExists(file) {
  417. return !system("test -f " parameterize(file))
  418. }
  419. function dirExists(file) {
  420. return !system("test -d " parameterize(file))
  421. }
  422. function detectProgram(prog, arg, returnOutput, temp) {
  423. if (returnOutput) {
  424. prog " " arg SUPERR | getline temp
  425. return temp
  426. } else
  427. return (prog " " arg SUPERR | getline) ? prog : NULLSTR
  428. }
  429. function getGitHead( line, group) {
  430. if (fileExists(".git/HEAD")) {
  431. getline line < ".git/HEAD"
  432. match(line, /^ref: (.*)$/, group)
  433. if (fileExists(".git/" group[1])) {
  434. getline line < (".git/" group[1])
  435. return substr(line, 1, 7)
  436. } else
  437. return NULLSTR
  438. } else
  439. return NULLSTR
  440. }
  441. BEGIN {
  442. initConst()
  443. initAnsiCode()
  444. initUrlEncoding()
  445. initUriSchemes()
  446. }
  447. function initGawk( group) {
  448. Gawk = "gawk"
  449. GawkVersion = PROCINFO["version"]
  450. split(PROCINFO["version"], group, ".")
  451. if (group[1] < 4) {
  452. e("[ERROR] Oops! Your gawk (version " GawkVersion ") "\
  453. "appears to be too old.\n"\
  454. " You need at least gawk 4.0.0 to run this program.")
  455. exit 1
  456. }
  457. }
  458. function initBiDi() {
  459. FriBidi = detectProgram("fribidi", "--version", 1)
  460. BiDiNoPad = FriBidi ? "fribidi --nopad" : "rev" SUPERR
  461. BiDi = FriBidi ? "fribidi --width %s" :
  462. "rev" SUPERR "| sed \"s/'/\\\\\\'/\" | xargs printf '%%s '"
  463. }
  464. function initRlwrap() {
  465. Rlwrap = detectProgram("rlwrap", "--version")
  466. }
  467. function initEmacs() {
  468. Emacs = detectProgram("emacs", "--version")
  469. }
  470. function initCurl() {
  471. Curl = detectProgram("curl", "--version")
  472. }
  473. function l(value, name, inline, heredoc, valOnly, numSub, sortedIn) {
  474. if (Option["debug"]) {
  475. if (name)
  476. da(value, name, inline, heredoc, valOnly, numSub, sortedIn)
  477. else
  478. d(value)
  479. }
  480. }
  481. function m(string) {
  482. if (Option["debug"])
  483. return ansi("cyan", string) RS
  484. }
  485. function newerVersion(ver1, ver2, i, group1, group2) {
  486. split(ver1, group1, ".")
  487. split(ver2, group2, ".")
  488. for (i = 1; i <= 4; i++) {
  489. if (group1[i] + 0 > group2[i] + 0)
  490. return 1
  491. else if (group1[i] + 0 < group2[i] + 0)
  492. return 0
  493. }
  494. return 0
  495. }
  496. function rlwrapMe( i, command) {
  497. initRlwrap()
  498. if (!Rlwrap) {
  499. l(">> not found: rlwrap")
  500. return 1
  501. }
  502. if (ENVIRON["TRANS_ENTRY"]) {
  503. command = Rlwrap " " ENVIRON["TRANS_ENTRY"] " "\
  504. parameterize("-no-rlwrap")
  505. } else if (fileExists(ENVIRON["TRANS_DIR"] "/" EntryScript)) {
  506. command = Rlwrap " sh "\
  507. parameterize(ENVIRON["TRANS_DIR"] "/" EntryScript)\
  508. " - " parameterize("-no-rlwrap")
  509. } else {
  510. l(">> not found: $TRANS_ENTRY or EntryPoint")
  511. return 1
  512. }
  513. for (i = 1; i < length(ARGV); i++)
  514. if (ARGV[i])
  515. command = command " " parameterize(ARGV[i])
  516. l(">> forking: " command)
  517. if (!system(command)) {
  518. l(">> process exited with code 0")
  519. exit ExitCode
  520. } else {
  521. l(">> process exited with non-zero return code")
  522. return 1
  523. }
  524. }
  525. function emacsMe( i, params, el, command) {
  526. initEmacs()
  527. if (!Emacs) {
  528. l(">> not found: emacs")
  529. return 1
  530. }
  531. params = ""
  532. for (i = 1; i < length(ARGV); i++)
  533. if (ARGV[i])
  534. params = params " " parameterize(ARGV[i], "\"")
  535. if (ENVIRON["TRANS_ENTRY"]) {
  536. el = "(progn (setq explicit-shell-file-name \"" ENVIRON["TRANS_ENTRY"] "\") "\
  537. "(setq explicit-" Command "-args '(\"-I\" \"-no-rlwrap\"" params ")) "\
  538. "(command-execute 'shell) (rename-buffer \"" Name "\"))"
  539. } else if (fileExists(ENVIRON["TRANS_DIR"] "/" EntryScript)) {
  540. el = "(progn (setq explicit-shell-file-name \"" "sh" "\") "\
  541. "(setq explicit-" "sh" "-args '(\"" ENVIRON["TRANS_DIR"] "/" EntryScript "\" \"-I\" \"-no-rlwrap\"" params ")) "\
  542. "(command-execute 'shell) (rename-buffer \"" Name "\"))"
  543. } else {
  544. l(">> not found: $TRANS_ENTRY or EntryPoint")
  545. return 1
  546. }
  547. command = Emacs " --eval " parameterize(el)
  548. l(">> forking: " command)
  549. if (!system(command)) {
  550. l(">> process exited with code 0")
  551. exit ExitCode
  552. } else {
  553. l(">> process exited with non-zero return code")
  554. return 1
  555. }
  556. }
  557. function curl(url, output, command, content, line) {
  558. initCurl()
  559. if (!Curl) {
  560. l(">> not found: curl")
  561. w("[WARNING] curl is not found.")
  562. return NULLSTR
  563. }
  564. command = Curl " --location --silent"
  565. if (Option["proxy"])
  566. command = command " --proxy " parameterize(Option["proxy"])
  567. if (Option["user-agent"])
  568. command = command " --user-agent " parameterize(Option["user-agent"])
  569. command = command " " parameterize(url)
  570. if (output) {
  571. command = command " --output " parameterize(output)
  572. system(command)
  573. return NULLSTR
  574. }
  575. content = NULLSTR
  576. while ((command |& getline line) > 0)
  577. content = (content ? content "\n" : NULLSTR) line
  578. return content
  579. }
  580. function curlPost(url, data, output, command, content, line) {
  581. initCurl()
  582. if (!Curl) {
  583. l(">> not found: curl")
  584. w("[WARNING] curl is not found.")
  585. return NULLSTR
  586. }
  587. command = Curl " --location --silent"
  588. if (Option["proxy"])
  589. command = command " --proxy " parameterize(Option["proxy"])
  590. if (Option["user-agent"])
  591. command = command " --user-agent " parameterize(Option["user-agent"])
  592. command = command " --request POST --data " parameterize(data)
  593. command = command " " parameterize(url)
  594. if (output) {
  595. command = command " --output " parameterize(output)
  596. system(command)
  597. return NULLSTR
  598. }
  599. content = NULLSTR
  600. while ((command |& getline line) > 0)
  601. content = (content ? content "\n" : NULLSTR) line
  602. return content
  603. }
  604. function dump(text, group, command, temp) {
  605. command = "hexdump" " -v -e'1/1 \"%03u\" \" \"'"
  606. ("echo " parameterize(text) PIPE command) | getline temp
  607. split(temp, group, " ")
  608. return length(group) - 1
  609. }
  610. function base64(text, command, temp) {
  611. command = "base64"
  612. ("echo -n " parameterize(text) PIPE command) | getline temp
  613. return temp
  614. }
  615. function uprintf(text, command, temp) {
  616. command = "echo -en " parameterize(text)
  617. ("bash -c " parameterize(command, "\"")) | getline temp
  618. return temp
  619. }
  620. function initLocale( i) {
  621. Locale["af"]["name"] = "Afrikaans"
  622. Locale["af"]["endonym"] = "Afrikaans"
  623. Locale["af"]["translations-of"] = "Vertalings van %s"
  624. Locale["af"]["definitions-of"] = "Definisies van %s"
  625. Locale["af"]["synonyms"] = "Sinonieme"
  626. Locale["af"]["examples"] = "Voorbeelde"
  627. Locale["af"]["see-also"] = "Sien ook"
  628. Locale["af"]["family"] = "Indo-European"
  629. Locale["af"]["iso"] = "afr"
  630. Locale["af"]["glotto"] = "afri1274"
  631. Locale["af"]["script"] = "Latn"
  632. Locale["sq"]["name"] = "Albanian"
  633. Locale["sq"]["endonym"] = "Shqip"
  634. Locale["sq"]["translations-of"] = "Përkthimet e %s"
  635. Locale["sq"]["definitions-of"] = "Përkufizime të %s"
  636. Locale["sq"]["synonyms"] = "Sinonime"
  637. Locale["sq"]["examples"] = "Shembuj"
  638. Locale["sq"]["see-also"] = "Shihni gjithashtu"
  639. Locale["sq"]["family"] = "Indo-European"
  640. Locale["sq"]["iso"] = "sqi"
  641. Locale["sq"]["glotto"] = "alba1267"
  642. Locale["sq"]["script"] = "Latn"
  643. Locale["am"]["name"] = "Amharic"
  644. Locale["am"]["endonym"] = "አማርኛ"
  645. Locale["am"]["translations-of"] = "የ %s ትርጉሞች"
  646. Locale["am"]["definitions-of"] = "የ %s ቃላት ፍችዎች"
  647. Locale["am"]["synonyms"] = "ተመሳሳይ ቃላት"
  648. Locale["am"]["examples"] = "ምሳሌዎች"
  649. Locale["am"]["see-also"] = "የሚከተለውንም ይመልከቱ"
  650. Locale["am"]["family"] = "Afro-Asiatic"
  651. Locale["am"]["iso"] = "amh"
  652. Locale["am"]["glotto"] = "amha1245"
  653. Locale["am"]["script"] = "Ethi"
  654. Locale["ar"]["name"] = "Arabic"
  655. Locale["ar"]["endonym"] = "العربية"
  656. Locale["ar"]["translations-of"] = "ترجمات %s"
  657. Locale["ar"]["definitions-of"] = "تعريفات %s"
  658. Locale["ar"]["synonyms"] = "مرادفات"
  659. Locale["ar"]["examples"] = "أمثلة"
  660. Locale["ar"]["see-also"] = "انظر أيضًا"
  661. Locale["ar"]["family"] = "Afro-Asiatic"
  662. Locale["ar"]["iso"] = "ara"
  663. Locale["ar"]["glotto"] = "stan1318"
  664. Locale["ar"]["script"] = "Arab"
  665. Locale["ar"]["rtl"] = "true"
  666. Locale["hy"]["name"] = "Armenian"
  667. Locale["hy"]["endonym"] = "Հայերեն"
  668. Locale["hy"]["translations-of"] = "%s-ի թարգմանությունները"
  669. Locale["hy"]["definitions-of"] = "%s-ի սահմանումները"
  670. Locale["hy"]["synonyms"] = "Հոմանիշներ"
  671. Locale["hy"]["examples"] = "Օրինակներ"
  672. Locale["hy"]["see-also"] = "Տես նաև"
  673. Locale["hy"]["family"] = "Indo-European"
  674. Locale["hy"]["iso"] = "hye"
  675. Locale["hy"]["glotto"] = "nucl1235"
  676. Locale["hy"]["script"] = "Armn"
  677. Locale["az"]["name"] = "Azerbaijani"
  678. Locale["az"]["endonym"] = "Azərbaycanca"
  679. Locale["az"]["translations-of"] = "%s sözünün tərcüməsi"
  680. Locale["az"]["definitions-of"] = "%s sözünün tərifləri"
  681. Locale["az"]["synonyms"] = "Sinonimlər"
  682. Locale["az"]["examples"] = "Nümunələr"
  683. Locale["az"]["see-also"] = "Həmçinin, baxın:"
  684. Locale["az"]["family"] = "Turkic"
  685. Locale["az"]["iso"] = "aze"
  686. Locale["az"]["glotto"] = "nort2697"
  687. Locale["az"]["script"] = "Latn"
  688. Locale["eu"]["name"] = "Basque"
  689. Locale["eu"]["endonym"] = "Euskara"
  690. Locale["eu"]["translations-of"] = "%s esapidearen itzulpena"
  691. Locale["eu"]["definitions-of"] = "Honen definizioak: %s"
  692. Locale["eu"]["synonyms"] = "Sinonimoak"
  693. Locale["eu"]["examples"] = "Adibideak"
  694. Locale["eu"]["see-also"] = "Ikusi hauek ere"
  695. Locale["eu"]["family"] = "Language Isolate"
  696. Locale["eu"]["iso"] = "eus"
  697. Locale["eu"]["glotto"] = "basq1248"
  698. Locale["eu"]["script"] = "Latn"
  699. Locale["be"]["name"] = "Belarusian"
  700. Locale["be"]["endonym"] = "беларуская"
  701. Locale["be"]["translations-of"] = "Пераклады %s"
  702. Locale["be"]["definitions-of"] = "Вызначэннi %s"
  703. Locale["be"]["synonyms"] = "Сінонімы"
  704. Locale["be"]["examples"] = "Прыклады"
  705. Locale["be"]["see-also"] = "Гл. таксама"
  706. Locale["be"]["family"] = "Indo-European"
  707. Locale["be"]["iso"] = "bel"
  708. Locale["be"]["glotto"] = "bela1254"
  709. Locale["be"]["script"] = "Cyrl"
  710. Locale["bn"]["name"] = "Bengali"
  711. Locale["bn"]["endonym"] = "বাংলা"
  712. Locale["bn"]["translations-of"] = "%s এর অনুবাদ"
  713. Locale["bn"]["definitions-of"] = "%s এর সংজ্ঞা"
  714. Locale["bn"]["synonyms"] = "প্রতিশব্দ"
  715. Locale["bn"]["examples"] = "উদাহরণ"
  716. Locale["bn"]["see-also"] = "আরো দেখুন"
  717. Locale["bn"]["family"] = "Indo-European"
  718. Locale["bn"]["iso"] = "ben"
  719. Locale["bn"]["glotto"] = "beng1280"
  720. Locale["bn"]["script"] = "Beng"
  721. Locale["bs"]["name"] = "Bosnian"
  722. Locale["bs"]["endonym"] = "Bosanski"
  723. Locale["bs"]["translations-of"] = "Prijevod za: %s"
  724. Locale["bs"]["definitions-of"] = "Definicije za %s"
  725. Locale["bs"]["synonyms"] = "Sinonimi"
  726. Locale["bs"]["examples"] = "Primjeri"
  727. Locale["bs"]["see-also"] = "Pogledajte i"
  728. Locale["bs"]["family"] = "Indo-European"
  729. Locale["bs"]["iso"] = "bos"
  730. Locale["bs"]["glotto"] = "bosn1245"
  731. Locale["bs"]["script"] = "Latn"
  732. Locale["bg"]["name"] = "Bulgarian"
  733. Locale["bg"]["endonym"] = "български"
  734. Locale["bg"]["translations-of"] = "Преводи на %s"
  735. Locale["bg"]["definitions-of"] = "Дефиниции за %s"
  736. Locale["bg"]["synonyms"] = "Синоними"
  737. Locale["bg"]["examples"] = "Примери"
  738. Locale["bg"]["see-also"] = "Вижте също"
  739. Locale["bg"]["family"] = "Indo-European"
  740. Locale["bg"]["iso"] = "bul"
  741. Locale["bg"]["glotto"] = "bulg1262"
  742. Locale["bg"]["script"] = "Cyrl"
  743. Locale["ca"]["name"] = "Catalan"
  744. Locale["ca"]["endonym"] = "Català"
  745. Locale["ca"]["translations-of"] = "Traduccions per a %s"
  746. Locale["ca"]["definitions-of"] = "Definicions de: %s"
  747. Locale["ca"]["synonyms"] = "Sinònims"
  748. Locale["ca"]["examples"] = "Exemples"
  749. Locale["ca"]["see-also"] = "Vegeu també"
  750. Locale["ca"]["family"] = "Indo-European"
  751. Locale["ca"]["iso"] = "cat"
  752. Locale["ca"]["glotto"] = "stan1289"
  753. Locale["ca"]["script"] = "Latn"
  754. Locale["ceb"]["name"] = "Cebuano"
  755. Locale["ceb"]["endonym"] = "Cebuano"
  756. Locale["ceb"]["translations-of"] = "%s Mga Paghubad sa PULONG_O_HUGPONG SA PAMULONG"
  757. Locale["ceb"]["definitions-of"] = "Mga kahulugan sa %s"
  758. Locale["ceb"]["synonyms"] = "Mga Kapulong"
  759. Locale["ceb"]["examples"] = "Mga pananglitan:"
  760. Locale["ceb"]["see-also"] = "Kitaa pag-usab"
  761. Locale["ceb"]["family"] = "Austronesian"
  762. Locale["ceb"]["iso"] = "ceb"
  763. Locale["ceb"]["glotto"] = "cebu1242"
  764. Locale["ceb"]["script"] = "Latn"
  765. Locale["ny"]["name"] = "Chichewa"
  766. Locale["ny"]["endonym"] = "Nyanja"
  767. Locale["ny"]["translations-of"] = "Matanthauzidwe a %s"
  768. Locale["ny"]["definitions-of"] = "Mamasulidwe a %s"
  769. Locale["ny"]["synonyms"] = "Mau ofanana"
  770. Locale["ny"]["examples"] = "Zitsanzo"
  771. Locale["ny"]["see-also"] = "Onaninso"
  772. Locale["ny"]["family"] = "Atlantic-Congo"
  773. Locale["ny"]["iso"] = "nya"
  774. Locale["ny"]["glotto"] = "nyan1308"
  775. Locale["ny"]["script"] = "Latn"
  776. Locale["zh-CN"]["name"] = "Chinese Simplified"
  777. Locale["zh-CN"]["endonym"] = "简体中文"
  778. Locale["zh-CN"]["translations-of"] = "%s 的翻译"
  779. Locale["zh-CN"]["definitions-of"] = "%s的定义"
  780. Locale["zh-CN"]["synonyms"] = "同义词"
  781. Locale["zh-CN"]["examples"] = "示例"
  782. Locale["zh-CN"]["see-also"] = "另请参阅"
  783. Locale["zh-CN"]["family"] = "Sino-Tibetan"
  784. Locale["zh-CN"]["iso"] = "zho-CN"
  785. Locale["zh-CN"]["glotto"] = "mand1415"
  786. Locale["zh-CN"]["script"] = "Hans"
  787. Locale["zh-CN"]["dictionary"] = "true"
  788. Locale["zh-TW"]["name"] = "Chinese Traditional"
  789. Locale["zh-TW"]["endonym"] = "正體中文"
  790. Locale["zh-TW"]["translations-of"] = "「%s」的翻譯"
  791. Locale["zh-TW"]["definitions-of"] = "「%s」的定義"
  792. Locale["zh-TW"]["synonyms"] = "同義詞"
  793. Locale["zh-TW"]["examples"] = "例句"
  794. Locale["zh-TW"]["see-also"] = "另請參閱"
  795. Locale["zh-TW"]["family"] = "Sino-Tibetan"
  796. Locale["zh-TW"]["iso"] = "zho-TW"
  797. Locale["zh-TW"]["glotto"] = "mand1415"
  798. Locale["zh-TW"]["script"] = "Hant"
  799. Locale["zh-TW"]["dictionary"] = "true"
  800. Locale["co"]["name"] = "Corsican"
  801. Locale["co"]["endonym"] = "Corsu"
  802. Locale["co"]["translations-of"] = "Traductions de %s"
  803. Locale["co"]["definitions-of"] = "Définitions de %s"
  804. Locale["co"]["synonyms"] = "Synonymes"
  805. Locale["co"]["examples"] = "Exemples"
  806. Locale["co"]["see-also"] = "Voir aussi"
  807. Locale["co"]["family"] = "Indo-European"
  808. Locale["co"]["iso"] = "cos"
  809. Locale["co"]["glotto"] = "cors1242"
  810. Locale["co"]["script"] = "Latn"
  811. Locale["hr"]["name"] = "Croatian"
  812. Locale["hr"]["endonym"] = "Hrvatski"
  813. Locale["hr"]["translations-of"] = "Prijevodi riječi ili izraza %s"
  814. Locale["hr"]["definitions-of"] = "Definicije riječi ili izraza %s"
  815. Locale["hr"]["synonyms"] = "Sinonimi"
  816. Locale["hr"]["examples"] = "Primjeri"
  817. Locale["hr"]["see-also"] = "Također pogledajte"
  818. Locale["hr"]["family"] = "Indo-European"
  819. Locale["hr"]["iso"] = "hrv"
  820. Locale["hr"]["glotto"] = "croa1245"
  821. Locale["hr"]["script"] = "Latn"
  822. Locale["cs"]["name"] = "Czech"
  823. Locale["cs"]["endonym"] = "Čeština"
  824. Locale["cs"]["translations-of"] = "Překlad výrazu %s"
  825. Locale["cs"]["definitions-of"] = "Definice výrazu %s"
  826. Locale["cs"]["synonyms"] = "Synonyma"
  827. Locale["cs"]["examples"] = "Příklady"
  828. Locale["cs"]["see-also"] = "Viz také"
  829. Locale["cs"]["family"] = "Indo-European"
  830. Locale["cs"]["iso"] = "ces"
  831. Locale["cs"]["glotto"] = "czec1258"
  832. Locale["cs"]["script"] = "Latn"
  833. Locale["da"]["name"] = "Danish"
  834. Locale["da"]["endonym"] = "Dansk"
  835. Locale["da"]["translations-of"] = "Oversættelser af %s"
  836. Locale["da"]["definitions-of"] = "Definitioner af %s"
  837. Locale["da"]["synonyms"] = "Synonymer"
  838. Locale["da"]["examples"] = "Eksempler"
  839. Locale["da"]["see-also"] = "Se også"
  840. Locale["da"]["family"] = "Indo-European"
  841. Locale["da"]["iso"] = "dan"
  842. Locale["da"]["glotto"] = "dani1285"
  843. Locale["da"]["script"] = "Latn"
  844. Locale["nl"]["name"] = "Dutch"
  845. Locale["nl"]["endonym"] = "Nederlands"
  846. Locale["nl"]["translations-of"] = "Vertalingen van %s"
  847. Locale["nl"]["definitions-of"] = "Definities van %s"
  848. Locale["nl"]["synonyms"] = "Synoniemen"
  849. Locale["nl"]["examples"] = "Voorbeelden"
  850. Locale["nl"]["see-also"] = "Zie ook"
  851. Locale["nl"]["family"] = "Indo-European"
  852. Locale["nl"]["iso"] = "nld"
  853. Locale["nl"]["glotto"] = "dutc1256"
  854. Locale["nl"]["script"] = "Latn"
  855. Locale["nl"]["dictionary"] = "true"
  856. Locale["en"]["name"] = "English"
  857. Locale["en"]["endonym"] = "English"
  858. Locale["en"]["translations-of"] = "Translations of %s"
  859. Locale["en"]["definitions-of"] = "Definitions of %s"
  860. Locale["en"]["synonyms"] = "Synonyms"
  861. Locale["en"]["examples"] = "Examples"
  862. Locale["en"]["see-also"] = "See also"
  863. Locale["en"]["family"] = "Indo-European"
  864. Locale["en"]["iso"] = "eng"
  865. Locale["en"]["glotto"] = "stan1293"
  866. Locale["en"]["script"] = "Latn"
  867. Locale["en"]["dictionary"] = "true"
  868. Locale["eo"]["name"] = "Esperanto"
  869. Locale["eo"]["endonym"] = "Esperanto"
  870. Locale["eo"]["translations-of"] = "Tradukoj de %s"
  871. Locale["eo"]["definitions-of"] = "Difinoj de %s"
  872. Locale["eo"]["synonyms"] = "Sinonimoj"
  873. Locale["eo"]["examples"] = "Ekzemploj"
  874. Locale["eo"]["see-also"] = "Vidu ankaŭ"
  875. Locale["eo"]["family"] = "Artificial Language"
  876. Locale["eo"]["iso"] = "epo"
  877. Locale["eo"]["glotto"] = "espe1235"
  878. Locale["eo"]["script"] = "Latn"
  879. Locale["et"]["name"] = "Estonian"
  880. Locale["et"]["endonym"] = "Eesti"
  881. Locale["et"]["translations-of"] = "Sõna(de) %s tõlked"
  882. Locale["et"]["definitions-of"] = "Sõna(de) %s definitsioonid"
  883. Locale["et"]["synonyms"] = "Sünonüümid"
  884. Locale["et"]["examples"] = "Näited"
  885. Locale["et"]["see-also"] = "Vt ka"
  886. Locale["et"]["family"] = "Uralic"
  887. Locale["et"]["iso"] = "est"
  888. Locale["et"]["glotto"] = "esto1258"
  889. Locale["et"]["script"] = "Latn"
  890. Locale["tl"]["name"] = "Filipino"
  891. Locale["tl"]["endonym"] = "Tagalog"
  892. Locale["tl"]["translations-of"] = "Mga pagsasalin ng %s"
  893. Locale["tl"]["definitions-of"] = "Mga kahulugan ng %s"
  894. Locale["tl"]["synonyms"] = "Mga Kasingkahulugan"
  895. Locale["tl"]["examples"] = "Mga Halimbawa"
  896. Locale["tl"]["see-also"] = "Tingnan rin ang"
  897. Locale["tl"]["family"] = "Austronesian"
  898. Locale["tl"]["iso"] = "tgl"
  899. Locale["tl"]["glotto"] = "taga1270"
  900. Locale["tl"]["script"] = "Latn"
  901. Locale["fi"]["name"] = "Finnish"
  902. Locale["fi"]["endonym"] = "Suomi"
  903. Locale["fi"]["translations-of"] = "Käännökset tekstille %s"
  904. Locale["fi"]["definitions-of"] = "Määritelmät kohteelle %s"
  905. Locale["fi"]["synonyms"] = "Synonyymit"
  906. Locale["fi"]["examples"] = "Esimerkkejä"
  907. Locale["fi"]["see-also"] = "Katso myös"
  908. Locale["fi"]["family"] = "Uralic"
  909. Locale["fi"]["iso"] = "fin"
  910. Locale["fi"]["glotto"] = "finn1318"
  911. Locale["fi"]["script"] = "Latn"
  912. Locale["fr"]["name"] = "French"
  913. Locale["fr"]["endonym"] = "Français"
  914. Locale["fr"]["translations-of"] = "Traductions de %s"
  915. Locale["fr"]["definitions-of"] = "Définitions de %s"
  916. Locale["fr"]["synonyms"] = "Synonymes"
  917. Locale["fr"]["examples"] = "Exemples"
  918. Locale["fr"]["see-also"] = "Voir aussi"
  919. Locale["fr"]["family"] = "Indo-European"
  920. Locale["fr"]["iso"] = "fra"
  921. Locale["fr"]["glotto"] = "stan1290"
  922. Locale["fr"]["script"] = "Latn"
  923. Locale["fr"]["dictionary"] = "true"
  924. Locale["gl"]["name"] = "Galician"
  925. Locale["gl"]["endonym"] = "Galego"
  926. Locale["gl"]["translations-of"] = "Traducións de %s"
  927. Locale["gl"]["definitions-of"] = "Definicións de %s"
  928. Locale["gl"]["synonyms"] = "Sinónimos"
  929. Locale["gl"]["examples"] = "Exemplos"
  930. Locale["gl"]["see-also"] = "Ver tamén"
  931. Locale["gl"]["family"] = "Indo-European"
  932. Locale["gl"]["iso"] = "glg"
  933. Locale["gl"]["glotto"] = "gali1258"
  934. Locale["gl"]["script"] = "Latn"
  935. Locale["ka"]["name"] = "Georgian"
  936. Locale["ka"]["endonym"] = "ქართული"
  937. Locale["ka"]["translations-of"] = "%s-ის თარგმანები"
  938. Locale["ka"]["definitions-of"] = "%s-ის განსაზღვრებები"
  939. Locale["ka"]["synonyms"] = "სინონიმები"
  940. Locale["ka"]["examples"] = "მაგალითები"
  941. Locale["ka"]["see-also"] = "ასევე იხილეთ"
  942. Locale["ka"]["family"] = "Kartvelian"
  943. Locale["ka"]["iso"] = "kat"
  944. Locale["ka"]["glotto"] = "nucl1302"
  945. Locale["ka"]["script"] = "Geor"
  946. Locale["de"]["name"] = "German"
  947. Locale["de"]["endonym"] = "Deutsch"
  948. Locale["de"]["translations-of"] = "Übersetzungen für %s"
  949. Locale["de"]["definitions-of"] = "Definitionen von %s"
  950. Locale["de"]["synonyms"] = "Synonyme"
  951. Locale["de"]["examples"] = "Beispiele"
  952. Locale["de"]["see-also"] = "Siehe auch"
  953. Locale["de"]["family"] = "Indo-European"
  954. Locale["de"]["iso"] = "deu"
  955. Locale["de"]["glotto"] = "stan1295"
  956. Locale["de"]["script"] = "Latn"
  957. Locale["de"]["dictionary"] = "true"
  958. Locale["el"]["name"] = "Greek"
  959. Locale["el"]["endonym"] = "Ελληνικά"
  960. Locale["el"]["translations-of"] = "Μεταφράσεις του %s"
  961. Locale["el"]["definitions-of"] = "Όρισμοί %s"
  962. Locale["el"]["synonyms"] = "Συνώνυμα"
  963. Locale["el"]["examples"] = "Παραδείγματα"
  964. Locale["el"]["see-also"] = "Δείτε επίσης"
  965. Locale["el"]["family"] = "Indo-European"
  966. Locale["el"]["iso"] = "ell"
  967. Locale["el"]["glotto"] = "mode1248"
  968. Locale["el"]["script"] = "Grek"
  969. Locale["gu"]["name"] = "Gujarati"
  970. Locale["gu"]["endonym"] = "ગુજરાતી"
  971. Locale["gu"]["translations-of"] = "%s ના અનુવાદ"
  972. Locale["gu"]["definitions-of"] = "%s ની વ્યાખ્યાઓ"
  973. Locale["gu"]["synonyms"] = "સમાનાર્થી"
  974. Locale["gu"]["examples"] = "ઉદાહરણો"
  975. Locale["gu"]["see-also"] = "આ પણ જુઓ"
  976. Locale["gu"]["family"] = "Indo-European"
  977. Locale["gu"]["iso"] = "guj"
  978. Locale["gu"]["glotto"] = "guja1252"
  979. Locale["gu"]["script"] = "Gujr"
  980. Locale["ht"]["name"] = "Haitian Creole"
  981. Locale["ht"]["endonym"] = "Kreyòl Ayisyen"
  982. Locale["ht"]["translations-of"] = "Tradiksyon %s"
  983. Locale["ht"]["definitions-of"] = "Definisyon nan %s"
  984. Locale["ht"]["synonyms"] = "Sinonim"
  985. Locale["ht"]["examples"] = "Egzanp:"
  986. Locale["ht"]["see-also"] = "Wè tou"
  987. Locale["ht"]["family"] = "Indo-European"
  988. Locale["ht"]["iso"] = "hat"
  989. Locale["ht"]["glotto"] = "hait1244"
  990. Locale["ht"]["script"] = "Latn"
  991. Locale["haw"]["name"] = "Hawaiian"
  992. Locale["haw"]["endonym"] = "ʻŌlelo Hawaiʻi"
  993. Locale["haw"]["family"] = "Austronesian"
  994. Locale["haw"]["iso"] = "haw"
  995. Locale["haw"]["glotto"] = "hawa1245"
  996. Locale["haw"]["script"] = "Latn"
  997. Locale["ha"]["name"] = "Hausa"
  998. Locale["ha"]["endonym"] = "Hausa"
  999. Locale["ha"]["translations-of"] = "Fassarar %s"
  1000. Locale["ha"]["definitions-of"] = "Ma'anoni na %s"
  1001. Locale["ha"]["synonyms"] = "Masu kamancin ma'ana"
  1002. Locale["ha"]["examples"] = "Misalai"
  1003. Locale["ha"]["see-also"] = "Duba kuma"
  1004. Locale["ha"]["family"] = "Afro-Asiatic"
  1005. Locale["ha"]["iso"] = "hau"
  1006. Locale["ha"]["glotto"] = "haus1257"
  1007. Locale["ha"]["script"] = "Latn"
  1008. Locale["he"]["name"] = "Hebrew"
  1009. Locale["he"]["endonym"] = "עִבְרִית"
  1010. Locale["he"]["translations-of"] = "תרגומים של %s"
  1011. Locale["he"]["definitions-of"] = "הגדרות של %s"
  1012. Locale["he"]["synonyms"] = "מילים נרדפות"
  1013. Locale["he"]["examples"] = "דוגמאות"
  1014. Locale["he"]["see-also"] = "ראה גם"
  1015. Locale["he"]["family"] = "Afro-Asiatic"
  1016. Locale["he"]["iso"] = "heb"
  1017. Locale["he"]["glotto"] = "hebr1245"
  1018. Locale["he"]["script"] = "Hebr"
  1019. Locale["he"]["rtl"] = "true"
  1020. Locale["hi"]["name"] = "Hindi"
  1021. Locale["hi"]["endonym"] = "हिन्दी"
  1022. Locale["hi"]["translations-of"] = "%s के अनुवाद"
  1023. Locale["hi"]["definitions-of"] = "%s की परिभाषाएं"
  1024. Locale["hi"]["synonyms"] = "समानार्थी"
  1025. Locale["hi"]["examples"] = "उदाहरण"
  1026. Locale["hi"]["see-also"] = "यह भी देखें"
  1027. Locale["hi"]["family"] = "Indo-European"
  1028. Locale["hi"]["iso"] = "hin"
  1029. Locale["hi"]["glotto"] = "hind1269"
  1030. Locale["hi"]["script"] = "Deva"
  1031. Locale["hmn"]["name"] = "Hmong"
  1032. Locale["hmn"]["endonym"] = "Hmoob"
  1033. Locale["hmn"]["translations-of"] = "Lus txhais: %s"
  1034. Locale["hmn"]["family"] = "Hmong-Mien"
  1035. Locale["hmn"]["iso"] = "hmn"
  1036. Locale["hmn"]["glotto"] = "firs1234"
  1037. Locale["hmn"]["script"] = "Latn"
  1038. Locale["hu"]["name"] = "Hungarian"
  1039. Locale["hu"]["endonym"] = "Magyar"
  1040. Locale["hu"]["translations-of"] = "%s fordításai"
  1041. Locale["hu"]["definitions-of"] = "%s jelentései"
  1042. Locale["hu"]["synonyms"] = "Szinonimák"
  1043. Locale["hu"]["examples"] = "Példák"
  1044. Locale["hu"]["see-also"] = "Lásd még"
  1045. Locale["hu"]["family"] = "Uralic"
  1046. Locale["hu"]["iso"] = "hun"
  1047. Locale["hu"]["glotto"] = "hung1274"
  1048. Locale["hu"]["script"] = "Latn"
  1049. Locale["is"]["name"] = "Icelandic"
  1050. Locale["is"]["endonym"] = "Íslenska"
  1051. Locale["is"]["translations-of"] = "Þýðingar á %s"
  1052. Locale["is"]["definitions-of"] = "Skilgreiningar á"
  1053. Locale["is"]["synonyms"] = "Samheiti"
  1054. Locale["is"]["examples"] = "Dæmi"
  1055. Locale["is"]["see-also"] = "Sjá einnig"
  1056. Locale["is"]["family"] = "Indo-European"
  1057. Locale["is"]["iso"] = "isl"
  1058. Locale["is"]["glotto"] = "icel1247"
  1059. Locale["is"]["script"] = "Latn"
  1060. Locale["ig"]["name"] = "Igbo"
  1061. Locale["ig"]["endonym"] = "Igbo"
  1062. Locale["ig"]["translations-of"] = "Ntụgharị asụsụ nke %s"
  1063. Locale["ig"]["definitions-of"] = "Nkọwapụta nke %s"
  1064. Locale["ig"]["synonyms"] = "Okwu oyiri"
  1065. Locale["ig"]["examples"] = "Ọmụmaatụ"
  1066. Locale["ig"]["see-also"] = "Hụkwuo"
  1067. Locale["ig"]["family"] = "Atlantic-Congo"
  1068. Locale["ig"]["iso"] = "ibo"
  1069. Locale["ig"]["glotto"] = "nucl1417"
  1070. Locale["ig"]["script"] = "Latn"
  1071. Locale["id"]["name"] = "Indonesian"
  1072. Locale["id"]["endonym"] = "Bahasa Indonesia"
  1073. Locale["id"]["translations-of"] = "Terjemahan dari %s"
  1074. Locale["id"]["definitions-of"] = "Definisi %s"
  1075. Locale["id"]["synonyms"] = "Sinonim"
  1076. Locale["id"]["examples"] = "Contoh"
  1077. Locale["id"]["see-also"] = "Lihat juga"
  1078. Locale["id"]["family"] = "Austronesian"
  1079. Locale["id"]["iso"] = "ind"
  1080. Locale["id"]["glotto"] = "indo1316"
  1081. Locale["id"]["script"] = "Latn"
  1082. Locale["ga"]["name"] = "Irish"
  1083. Locale["ga"]["endonym"] = "Gaeilge"
  1084. Locale["ga"]["translations-of"] = "Aistriúcháin ar %s"
  1085. Locale["ga"]["definitions-of"] = "Sainmhínithe ar %s"
  1086. Locale["ga"]["synonyms"] = "Comhchiallaigh"
  1087. Locale["ga"]["examples"] = "Samplaí"
  1088. Locale["ga"]["see-also"] = "féach freisin"
  1089. Locale["ga"]["family"] = "Indo-European"
  1090. Locale["ga"]["iso"] = "gle"
  1091. Locale["ga"]["glotto"] = "iris1253"
  1092. Locale["ga"]["script"] = "Latn"
  1093. Locale["it"]["name"] = "Italian"
  1094. Locale["it"]["endonym"] = "Italiano"
  1095. Locale["it"]["translations-of"] = "Traduzioni di %s"
  1096. Locale["it"]["definitions-of"] = "Definizioni di %s"
  1097. Locale["it"]["synonyms"] = "Sinonimi"
  1098. Locale["it"]["examples"] = "Esempi"
  1099. Locale["it"]["see-also"] = "Vedi anche"
  1100. Locale["it"]["family"] = "Indo-European"
  1101. Locale["it"]["iso"] = "ita"
  1102. Locale["it"]["glotto"] = "ital1282"
  1103. Locale["it"]["script"] = "Latn"
  1104. Locale["it"]["dictionary"] = "true"
  1105. Locale["ja"]["name"] = "Japanese"
  1106. Locale["ja"]["endonym"] = "日本語"
  1107. Locale["ja"]["translations-of"] = "「%s」の翻訳"
  1108. Locale["ja"]["definitions-of"] = "%s の定義"
  1109. Locale["ja"]["synonyms"] = "同義語"
  1110. Locale["ja"]["examples"] = "例"
  1111. Locale["ja"]["see-also"] = "関連項目"
  1112. Locale["ja"]["family"] = "Japonic"
  1113. Locale["ja"]["iso"] = "jpn"
  1114. Locale["ja"]["glotto"] = "nucl1643"
  1115. Locale["ja"]["script"] = "Jpan"
  1116. Locale["ja"]["dictionary"] = "true"
  1117. Locale["jv"]["name"] = "Javanese"
  1118. Locale["jv"]["endonym"] = "Basa Jawa"
  1119. Locale["jv"]["translations-of"] = "Terjemahan %s"
  1120. Locale["jv"]["definitions-of"] = "Arti %s"
  1121. Locale["jv"]["synonyms"] = "Sinonim"
  1122. Locale["jv"]["examples"] = "Conto"
  1123. Locale["jv"]["see-also"] = "Deleng uga"
  1124. Locale["jv"]["family"] = "Austronesian"
  1125. Locale["jv"]["iso"] = "jav"
  1126. Locale["jv"]["glotto"] = "java1254"
  1127. Locale["jv"]["script"] = "Latn"
  1128. Locale["kn"]["name"] = "Kannada"
  1129. Locale["kn"]["endonym"] = "ಕನ್ನಡ"
  1130. Locale["kn"]["translations-of"] = "%s ನ ಅನುವಾದಗಳು"
  1131. Locale["kn"]["definitions-of"] = "%s ನ ವ್ಯಾಖ್ಯಾನಗಳು"
  1132. Locale["kn"]["synonyms"] = "ಸಮಾನಾರ್ಥಕಗಳು"
  1133. Locale["kn"]["examples"] = "ಉದಾಹರಣೆಗಳು"
  1134. Locale["kn"]["see-also"] = "ಇದನ್ನೂ ಗಮನಿಸಿ"
  1135. Locale["kn"]["family"] = "Dravidian"
  1136. Locale["kn"]["iso"] = "kan"
  1137. Locale["kn"]["glotto"] = "nucl1305"
  1138. Locale["kn"]["script"] = "Knda"
  1139. Locale["kk"]["name"] = "Kazakh"
  1140. Locale["kk"]["endonym"] = "Қазақ тілі"
  1141. Locale["kk"]["translations-of"] = "%s аудармалары"
  1142. Locale["kk"]["definitions-of"] = "%s анықтамалары"
  1143. Locale["kk"]["synonyms"] = "Синонимдер"
  1144. Locale["kk"]["examples"] = "Мысалдар"
  1145. Locale["kk"]["see-also"] = "Келесі тізімді де көріңіз:"
  1146. Locale["kk"]["family"] = "Turkic"
  1147. Locale["kk"]["iso"] = "kaz"
  1148. Locale["kk"]["glotto"] = "kaza1248"
  1149. Locale["kk"]["script"] = "Cyrl"
  1150. Locale["km"]["name"] = "Khmer"
  1151. Locale["km"]["endonym"] = "ភាសាខ្មែរ"
  1152. Locale["km"]["translations-of"] = "ការ​បក​ប្រែ​នៃ %s"
  1153. Locale["km"]["definitions-of"] = "និយមន័យ​នៃ​ %s"
  1154. Locale["km"]["synonyms"] = "សទិសន័យ"
  1155. Locale["km"]["examples"] = "ឧទាហរណ៍"
  1156. Locale["km"]["see-also"] = "មើល​ផង​ដែរ"
  1157. Locale["km"]["family"] = "Austroasiatic"
  1158. Locale["km"]["iso"] = "khm"
  1159. Locale["km"]["glotto"] = "cent1989"
  1160. Locale["km"]["script"] = "Khmr"
  1161. Locale["ko"]["name"] = "Korean"
  1162. Locale["ko"]["endonym"] = "한국어"
  1163. Locale["ko"]["translations-of"] = "%s의 번역"
  1164. Locale["ko"]["definitions-of"] = "%s의 정의"
  1165. Locale["ko"]["synonyms"] = "동의어"
  1166. Locale["ko"]["examples"] = "예문"
  1167. Locale["ko"]["see-also"] = "참조"
  1168. Locale["ko"]["family"] = "Koreanic"
  1169. Locale["ko"]["iso"] = "kor"
  1170. Locale["ko"]["glotto"] = "kore1280"
  1171. Locale["ko"]["script"] = "Kore"
  1172. Locale["ko"]["dictionary"] = "true"
  1173. Locale["ku"]["name"] = "Kurdish"
  1174. Locale["ku"]["endonym"] = "Kurdî"
  1175. Locale["ku"]["family"] = "Indo-European"
  1176. Locale["ku"]["iso"] = "kur"
  1177. Locale["ku"]["glotto"] = "kurd1259"
  1178. Locale["ku"]["script"] = "Latn"
  1179. Locale["ky"]["name"] = "Kyrgyz"
  1180. Locale["ky"]["endonym"] = "Кыргызча"
  1181. Locale["ky"]["translations-of"] = "%s котормосу"
  1182. Locale["ky"]["definitions-of"] = "%s аныктамасы"
  1183. Locale["ky"]["synonyms"] = "Синонимдер"
  1184. Locale["ky"]["examples"] = "Мисалдар"
  1185. Locale["ky"]["see-also"] = "Дагы караңыз"
  1186. Locale["ky"]["family"] = "Turkic"
  1187. Locale["ky"]["iso"] = "kir"
  1188. Locale["ky"]["glotto"] = "kirg1245"
  1189. Locale["ky"]["script"] = "Cyrl"
  1190. Locale["lo"]["name"] = "Lao"
  1191. Locale["lo"]["endonym"] = "ລາວ"
  1192. Locale["lo"]["translations-of"] = "ຄຳ​ແປ​ສຳລັບ %s"
  1193. Locale["lo"]["definitions-of"] = "ຄວາມໝາຍຂອງ %s"
  1194. Locale["lo"]["synonyms"] = "ຄຳທີ່ຄ້າຍກັນ %s"
  1195. Locale["lo"]["examples"] = "ຕົວຢ່າງ"
  1196. Locale["lo"]["see-also"] = "ເບິ່ງ​ເພີ່ມ​ເຕີມ"
  1197. Locale["lo"]["family"] = "Tai-Kadai"
  1198. Locale["lo"]["iso"] = "lao"
  1199. Locale["lo"]["glotto"] = "laoo1244"
  1200. Locale["lo"]["script"] = "Laoo"
  1201. Locale["la"]["name"] = "Latin"
  1202. Locale["la"]["endonym"] = "Latina"
  1203. Locale["la"]["translations-of"] = "Versio de %s"
  1204. Locale["la"]["family"] = "Indo-European"
  1205. Locale["la"]["iso"] = "lat"
  1206. Locale["la"]["glotto"] = "lati1261"
  1207. Locale["la"]["script"] = "Latn"
  1208. Locale["lv"]["name"] = "Latvian"
  1209. Locale["lv"]["endonym"] = "Latviešu"
  1210. Locale["lv"]["translations-of"] = "%s tulkojumi"
  1211. Locale["lv"]["definitions-of"] = "%s definīcijas"
  1212. Locale["lv"]["synonyms"] = "Sinonīmi"
  1213. Locale["lv"]["examples"] = "Piemēri"
  1214. Locale["lv"]["see-also"] = "Skatiet arī"
  1215. Locale["lv"]["family"] = "Indo-European"
  1216. Locale["lv"]["iso"] = "lav"
  1217. Locale["lv"]["glotto"] = "latv1249"
  1218. Locale["lv"]["script"] = "Latn"
  1219. Locale["lt"]["name"] = "Lithuanian"
  1220. Locale["lt"]["endonym"] = "Lietuvių"
  1221. Locale["lt"]["translations-of"] = "„%s“ vertimai"
  1222. Locale["lt"]["definitions-of"] = "„%s“ apibrėžimai"
  1223. Locale["lt"]["synonyms"] = "Sinonimai"
  1224. Locale["lt"]["examples"] = "Pavyzdžiai"
  1225. Locale["lt"]["see-also"] = "Taip pat žiūrėkite"
  1226. Locale["lt"]["family"] = "Indo-European"
  1227. Locale["lt"]["iso"] = "lit"
  1228. Locale["lt"]["glotto"] = "lith1251"
  1229. Locale["lt"]["script"] = "Latn"
  1230. Locale["lb"]["name"] = "Luxembourgish"
  1231. Locale["lb"]["endonym"] = "Lëtzebuergesch"
  1232. Locale["lb"]["family"] = "Indo-European"
  1233. Locale["lb"]["iso"] = "ltz"
  1234. Locale["lb"]["glotto"] = "luxe1241"
  1235. Locale["lb"]["script"] = "Latn"
  1236. Locale["mk"]["name"] = "Macedonian"
  1237. Locale["mk"]["endonym"] = "Македонски"
  1238. Locale["mk"]["translations-of"] = "Преводи на %s"
  1239. Locale["mk"]["definitions-of"] = "Дефиниции на %s"
  1240. Locale["mk"]["synonyms"] = "Синоними"
  1241. Locale["mk"]["examples"] = "Примери"
  1242. Locale["mk"]["see-also"] = "Види и"
  1243. Locale["mk"]["family"] = "Indo-European"
  1244. Locale["mk"]["iso"] = "mkd"
  1245. Locale["mk"]["glotto"] = "mace1250"
  1246. Locale["mk"]["script"] = "Cyrl"
  1247. Locale["mg"]["name"] = "Malagasy"
  1248. Locale["mg"]["endonym"] = "Malagasy"
  1249. Locale["mg"]["translations-of"] = "Dikan'ny %s"
  1250. Locale["mg"]["definitions-of"] = "Famaritana ny %s"
  1251. Locale["mg"]["synonyms"] = "Mitovy hevitra"
  1252. Locale["mg"]["examples"] = "Ohatra"
  1253. Locale["mg"]["see-also"] = "Jereo ihany koa"
  1254. Locale["mg"]["family"] = "Austronesian"
  1255. Locale["mg"]["iso"] = "mlg"
  1256. Locale["mg"]["glotto"] = "plat1254"
  1257. Locale["mg"]["script"] = "Latn"
  1258. Locale["ms"]["name"] = "Malay"
  1259. Locale["ms"]["endonym"] = "Bahasa Melayu"
  1260. Locale["ms"]["translations-of"] = "Terjemahan %s"
  1261. Locale["ms"]["definitions-of"] = "Takrif %s"
  1262. Locale["ms"]["synonyms"] = "Sinonim"
  1263. Locale["ms"]["examples"] = "Contoh"
  1264. Locale["ms"]["see-also"] = "Lihat juga"
  1265. Locale["ms"]["family"] = "Austronesian"
  1266. Locale["ms"]["iso"] = "msa"
  1267. Locale["ms"]["glotto"] = "stan1306"
  1268. Locale["ms"]["script"] = "Latn"
  1269. Locale["ml"]["name"] = "Malayalam"
  1270. Locale["ml"]["endonym"] = "മലയാളം"
  1271. Locale["ml"]["translations-of"] = "%s എന്നതിന്റെ വിവർത്തനങ്ങൾ"
  1272. Locale["ml"]["definitions-of"] = "%s എന്നതിന്റെ നിർവ്വചനങ്ങൾ"
  1273. Locale["ml"]["synonyms"] = "പര്യായങ്ങള്‍"
  1274. Locale["ml"]["examples"] = "ഉദാഹരണങ്ങള്‍"
  1275. Locale["ml"]["see-also"] = "ഇതും കാണുക"
  1276. Locale["ml"]["family"] = "Dravidian"
  1277. Locale["ml"]["iso"] = "mal"
  1278. Locale["ml"]["glotto"] = "mala1464"
  1279. Locale["ml"]["script"] = "Mlym"
  1280. Locale["mt"]["name"] = "Maltese"
  1281. Locale["mt"]["endonym"] = "Malti"
  1282. Locale["mt"]["translations-of"] = "Traduzzjonijiet ta' %s"
  1283. Locale["mt"]["definitions-of"] = "Definizzjonijiet ta' %s"
  1284. Locale["mt"]["synonyms"] = "Sinonimi"
  1285. Locale["mt"]["examples"] = "Eżempji"
  1286. Locale["mt"]["see-also"] = "Ara wkoll"
  1287. Locale["mt"]["family"] = "Afro-Asiatic"
  1288. Locale["mt"]["iso"] = "mlt"
  1289. Locale["mt"]["glotto"] = "malt1254"
  1290. Locale["mt"]["script"] = "Latn"
  1291. Locale["mi"]["name"] = "Maori"
  1292. Locale["mi"]["endonym"] = "Māori"
  1293. Locale["mi"]["translations-of"] = "Ngā whakamāoritanga o %s"
  1294. Locale["mi"]["definitions-of"] = "Ngā whakamārama o %s"
  1295. Locale["mi"]["synonyms"] = "Ngā Kupu Taurite"
  1296. Locale["mi"]["examples"] = "Ngā Tauira:"
  1297. Locale["mi"]["see-also"] = "Tiro hoki:"
  1298. Locale["mi"]["family"] = "Austronesian"
  1299. Locale["mi"]["iso"] = "mri"
  1300. Locale["mi"]["glotto"] = "maor1246"
  1301. Locale["mi"]["script"] = "Latn"
  1302. Locale["mr"]["name"] = "Marathi"
  1303. Locale["mr"]["endonym"] = "मराठी"
  1304. Locale["mr"]["translations-of"] = "%s ची भाषांतरे"
  1305. Locale["mr"]["definitions-of"] = "%s च्या व्याख्या"
  1306. Locale["mr"]["synonyms"] = "समानार्थी शब्द"
  1307. Locale["mr"]["examples"] = "उदाहरणे"
  1308. Locale["mr"]["see-also"] = "हे देखील पहा"
  1309. Locale["mr"]["family"] = "Indo-European"
  1310. Locale["mr"]["iso"] = "mar"
  1311. Locale["mr"]["glotto"] = "mara1378"
  1312. Locale["mr"]["script"] = "Deva"
  1313. Locale["mn"]["name"] = "Mongolian"
  1314. Locale["mn"]["endonym"] = "Монгол"
  1315. Locale["mn"]["translations-of"] = "%s-н орчуулга"
  1316. Locale["mn"]["definitions-of"] = "%s үгийн тодорхойлолт"
  1317. Locale["mn"]["synonyms"] = "Ойролцоо утгатай"
  1318. Locale["mn"]["examples"] = "Жишээнүүд"
  1319. Locale["mn"]["see-also"] = "Мөн харах"
  1320. Locale["mn"]["family"] = "Mongolic"
  1321. Locale["mn"]["iso"] = "mon"
  1322. Locale["mn"]["glotto"] = "mong1331"
  1323. Locale["mn"]["script"] = "Cyrl"
  1324. Locale["my"]["name"] = "Myanmar"
  1325. Locale["my"]["endonym"] = "မြန်မာစာ"
  1326. Locale["my"]["translations-of"] = "%s၏ ဘာသာပြန်ဆိုချက်များ"
  1327. Locale["my"]["definitions-of"] = "%s၏ အနက်ဖွင့်ဆိုချက်များ"
  1328. Locale["my"]["synonyms"] = "ကြောင်းတူသံကွဲများ"
  1329. Locale["my"]["examples"] = "ဥပမာ"
  1330. Locale["my"]["see-also"] = "ဖော်ပြပါများကိုလဲ ကြည့်ပါ"
  1331. Locale["my"]["family"] = "Sino-Tibetan"
  1332. Locale["my"]["iso"] = "mya"
  1333. Locale["my"]["glotto"] = "nucl1310"
  1334. Locale["my"]["script"] = "Mymr"
  1335. Locale["ne"]["name"] = "Nepali"
  1336. Locale["ne"]["endonym"] = "नेपाली"
  1337. Locale["ne"]["translations-of"] = "%sका अनुवाद"
  1338. Locale["ne"]["definitions-of"] = "%sको परिभाषा"
  1339. Locale["ne"]["synonyms"] = "समानार्थीहरू"
  1340. Locale["ne"]["examples"] = "उदाहरणहरु"
  1341. Locale["ne"]["see-also"] = "यो पनि हेर्नुहोस्"
  1342. Locale["ne"]["family"] = "Indo-European"
  1343. Locale["ne"]["iso"] = "nep"
  1344. Locale["ne"]["glotto"] = "nepa1254"
  1345. Locale["ne"]["script"] = "Deva"
  1346. Locale["no"]["name"] = "Norwegian"
  1347. Locale["no"]["endonym"] = "Norsk"
  1348. Locale["no"]["translations-of"] = "Oversettelser av %s"
  1349. Locale["no"]["definitions-of"] = "Definisjoner av %s"
  1350. Locale["no"]["synonyms"] = "Synonymer"
  1351. Locale["no"]["examples"] = "Eksempler"
  1352. Locale["no"]["see-also"] = "Se også"
  1353. Locale["no"]["family"] = "Indo-European"
  1354. Locale["no"]["iso"] = "nor"
  1355. Locale["no"]["glotto"] = "norw1258"
  1356. Locale["no"]["script"] = "Latn"
  1357. Locale["ps"]["name"] = "Pashto"
  1358. Locale["ps"]["endonym"] = "پښتو"
  1359. Locale["ps"]["translations-of"] = "د %sژباړې"
  1360. Locale["ps"]["definitions-of"] = "د%s تعریفونه"
  1361. Locale["ps"]["synonyms"] = "مترادف لغتونه"
  1362. Locale["ps"]["examples"] = "بېلګې"
  1363. Locale["ps"]["see-also"] = "دا هم ووینئ"
  1364. Locale["ps"]["family"] = "Indo-European"
  1365. Locale["ps"]["iso"] = "pus"
  1366. Locale["ps"]["glotto"] = "pash1269"
  1367. Locale["ps"]["script"] = "Arab"
  1368. Locale["ps"]["rtl"] = "true"
  1369. Locale["fa"]["name"] = "Persian"
  1370. Locale["fa"]["endonym"] = "فارسی"
  1371. Locale["fa"]["translations-of"] = "ترجمه‌های %s"
  1372. Locale["fa"]["definitions-of"] = "تعریف‌های %s"
  1373. Locale["fa"]["synonyms"] = "مترادف‌ها"
  1374. Locale["fa"]["examples"] = "مثال‌ها"
  1375. Locale["fa"]["see-also"] = "همچنین مراجعه کنید به"
  1376. Locale["fa"]["family"] = "Indo-European"
  1377. Locale["fa"]["iso"] = "fas"
  1378. Locale["fa"]["glotto"] = "west2369"
  1379. Locale["fa"]["script"] = "Arab"
  1380. Locale["fa"]["rtl"] = "true"
  1381. Locale["pl"]["name"] = "Polish"
  1382. Locale["pl"]["endonym"] = "Polski"
  1383. Locale["pl"]["translations-of"] = "Tłumaczenia %s"
  1384. Locale["pl"]["definitions-of"] = "%s – definicje"
  1385. Locale["pl"]["synonyms"] = "Synonimy"
  1386. Locale["pl"]["examples"] = "Przykłady"
  1387. Locale["pl"]["see-also"] = "Zobacz też"
  1388. Locale["pl"]["family"] = "Indo-European"
  1389. Locale["pl"]["iso"] = "pol"
  1390. Locale["pl"]["glotto"] = "poli1260"
  1391. Locale["pl"]["script"] = "Latn"
  1392. Locale["pt"]["name"] = "Portuguese"
  1393. Locale["pt"]["endonym"] = "Português"
  1394. Locale["pt"]["translations-of"] = "Traduções de %s"
  1395. Locale["pt"]["definitions-of"] = "Definições de %s"
  1396. Locale["pt"]["synonyms"] = "Sinônimos"
  1397. Locale["pt"]["examples"] = "Exemplos"
  1398. Locale["pt"]["see-also"] = "Veja também"
  1399. Locale["pt"]["family"] = "Indo-European"
  1400. Locale["pt"]["iso"] = "por"
  1401. Locale["pt"]["glotto"] = "port1283"
  1402. Locale["pt"]["script"] = "Latn"
  1403. Locale["pt"]["dictionary"] = "true"
  1404. Locale["pa"]["name"] = "Punjabi"
  1405. Locale["pa"]["endonym"] = "ਪੰਜਾਬੀ"
  1406. Locale["pa"]["translations-of"] = "ਦੇ ਅਨੁਵਾਦ%s"
  1407. Locale["pa"]["definitions-of"] = "ਦੀਆਂ ਪਰਿਭਾਸ਼ਾ %s"
  1408. Locale["pa"]["synonyms"] = "ਸਮਾਨਾਰਥਕ ਸ਼ਬਦ"
  1409. Locale["pa"]["examples"] = "ਉਦਾਹਰਣਾਂ"
  1410. Locale["pa"]["see-also"] = "ਇਹ ਵੀ ਵੇਖੋ"
  1411. Locale["pa"]["family"] = "Indo-European"
  1412. Locale["pa"]["iso"] = "pan"
  1413. Locale["pa"]["glotto"] = "panj1256"
  1414. Locale["pa"]["script"] = "Guru"
  1415. Locale["ro"]["name"] = "Romanian"
  1416. Locale["ro"]["endonym"] = "Română"
  1417. Locale["ro"]["translations-of"] = "Traduceri pentru %s"
  1418. Locale["ro"]["definitions-of"] = "Definiții pentru %s"
  1419. Locale["ro"]["synonyms"] = "Sinonime"
  1420. Locale["ro"]["examples"] = "Exemple"
  1421. Locale["ro"]["see-also"] = "Vedeți și"
  1422. Locale["ro"]["family"] = "Indo-European"
  1423. Locale["ro"]["iso"] = "ron"
  1424. Locale["ro"]["glotto"] = "roma1327"
  1425. Locale["ro"]["script"] = "Latn"
  1426. Locale["ru"]["name"] = "Russian"
  1427. Locale["ru"]["endonym"] = "Русский"
  1428. Locale["ru"]["translations-of"] = "%s: варианты перевода"
  1429. Locale["ru"]["definitions-of"] = "%s – определения"
  1430. Locale["ru"]["synonyms"] = "Синонимы"
  1431. Locale["ru"]["examples"] = "Примеры"
  1432. Locale["ru"]["see-also"] = "Похожие слова"
  1433. Locale["ru"]["family"] = "Indo-European"
  1434. Locale["ru"]["iso"] = "rus"
  1435. Locale["ru"]["glotto"] = "russ1263"
  1436. Locale["ru"]["script"] = "Cyrl"
  1437. Locale["ru"]["dictionary"] = "true"
  1438. Locale["sm"]["name"] = "Samoan"
  1439. Locale["sm"]["endonym"] = "Gagana Sāmoa"
  1440. Locale["sm"]["family"] = "Austronesian"
  1441. Locale["sm"]["iso"] = "smo"
  1442. Locale["sm"]["glotto"] = "samo1305"
  1443. Locale["sm"]["script"] = "Latn"
  1444. Locale["gd"]["name"] = "Scots Gaelic"
  1445. Locale["gd"]["endonym"] = "Gàidhlig"
  1446. Locale["gd"]["translations-of"] = "Eadar-theangachadh airson %s"
  1447. Locale["gd"]["definitions-of"] = "Deifiniseanan airson %s"
  1448. Locale["gd"]["synonyms"] = "Co-fhaclan"
  1449. Locale["gd"]["examples"] = "Buill-eisimpleir"
  1450. Locale["gd"]["see-also"] = "Faic na leanas cuideachd"
  1451. Locale["gd"]["family"] = "Indo-European"
  1452. Locale["gd"]["iso"] = "gla"
  1453. Locale["gd"]["glotto"] = "scot1245"
  1454. Locale["gd"]["script"] = "Latn"
  1455. Locale["sr-Cyrl"]["name"] = "Serbian (Cyrillic)"
  1456. Locale["sr-Cyrl"]["endonym"] = "српски"
  1457. Locale["sr-Cyrl"]["translations-of"] = "Преводи за „%s“"
  1458. Locale["sr-Cyrl"]["definitions-of"] = "Дефиниције за %s"
  1459. Locale["sr-Cyrl"]["synonyms"] = "Синоними"
  1460. Locale["sr-Cyrl"]["examples"] = "Примери"
  1461. Locale["sr-Cyrl"]["see-also"] = "Погледајте такође"
  1462. Locale["sr-Cyrl"]["family"] = "Indo-European"
  1463. Locale["sr-Cyrl"]["iso"] = "srp-Cyrl"
  1464. Locale["sr-Cyrl"]["glotto"] = "serb1264"
  1465. Locale["sr-Cyrl"]["script"] = "Cyrl"
  1466. Locale["sr-Latn"]["name"] = "Serbian (Latin)"
  1467. Locale["sr-Latn"]["endonym"] = "srpski"
  1468. Locale["sr-Latn"]["translations-of"] = "Prevodi za „%s“"
  1469. Locale["sr-Latn"]["definitions-of"] = "Definicije za %s"
  1470. Locale["sr-Latn"]["synonyms"] = "Sinonimi"
  1471. Locale["sr-Latn"]["examples"] = "Primeri"
  1472. Locale["sr-Latn"]["see-also"] = "Pogledajte takođe"
  1473. Locale["sr-Latn"]["family"] = "Indo-European"
  1474. Locale["sr-Latn"]["iso"] = "srp-Latn"
  1475. Locale["sr-Latn"]["glotto"] = "serb1264"
  1476. Locale["sr-Latn"]["script"] = "Latn"
  1477. Locale["st"]["name"] = "Sesotho"
  1478. Locale["st"]["endonym"] = "Sesotho"
  1479. Locale["st"]["translations-of"] = "Liphetolelo tsa %s"
  1480. Locale["st"]["definitions-of"] = "Meelelo ea %s"
  1481. Locale["st"]["synonyms"] = "Mantsoe a tšoanang ka moelelo"
  1482. Locale["st"]["examples"] = "Mehlala"
  1483. Locale["st"]["see-also"] = "Bona hape"
  1484. Locale["st"]["family"] = "Atlantic-Congo"
  1485. Locale["st"]["iso"] = "sot"
  1486. Locale["st"]["glotto"] = "sout2807"
  1487. Locale["st"]["script"] = "Latn"
  1488. Locale["sn"]["name"] = "Shona"
  1489. Locale["sn"]["endonym"] = "chiShona"
  1490. Locale["sn"]["translations-of"] = "Shanduro dze %s"
  1491. Locale["sn"]["definitions-of"] = "Zvinoreva %s"
  1492. Locale["sn"]["synonyms"] = "Mashoko anoreva zvakafana nemamwe"
  1493. Locale["sn"]["examples"] = "Mienzaniso"
  1494. Locale["sn"]["see-also"] = "Onawo"
  1495. Locale["sn"]["family"] = "Atlantic-Congo"
  1496. Locale["sn"]["iso"] = "sna"
  1497. Locale["sn"]["glotto"] = "core1255"
  1498. Locale["sn"]["script"] = "Latn"
  1499. Locale["sd"]["name"] = "Sindhi"
  1500. Locale["sd"]["endonym"] = "سنڌي"
  1501. Locale["sd"]["translations-of"] = "%s جو ترجمو"
  1502. Locale["sd"]["definitions-of"] = "%s جون وصفون"
  1503. Locale["sd"]["synonyms"] = "هم معني"
  1504. Locale["sd"]["examples"] = "مثالون"
  1505. Locale["sd"]["see-also"] = "به ڏسو"
  1506. Locale["sd"]["family"] = "Indo-European"
  1507. Locale["sd"]["iso"] = "snd"
  1508. Locale["sd"]["glotto"] = "sind1272"
  1509. Locale["sd"]["script"] = "Arab"
  1510. Locale["sd"]["rtl"] = "true"
  1511. Locale["si"]["name"] = "Sinhala"
  1512. Locale["si"]["endonym"] = "සිංහල"
  1513. Locale["si"]["translations-of"] = "%s හි පරිවර්තන"
  1514. Locale["si"]["definitions-of"] = "%s හි නිර්වචන"
  1515. Locale["si"]["synonyms"] = "සමානාර්ථ පද"
  1516. Locale["si"]["examples"] = "උදාහරණ"
  1517. Locale["si"]["see-also"] = "මෙයත් බලන්න"
  1518. Locale["si"]["family"] = "Indo-European"
  1519. Locale["si"]["iso"] = "sin"
  1520. Locale["si"]["glotto"] = "sinh1246"
  1521. Locale["si"]["script"] = "Sinh"
  1522. Locale["sk"]["name"] = "Slovak"
  1523. Locale["sk"]["endonym"] = "Slovenčina"
  1524. Locale["sk"]["translations-of"] = "Preklady výrazu: %s"
  1525. Locale["sk"]["definitions-of"] = "Definície výrazu %s"
  1526. Locale["sk"]["synonyms"] = "Synonymá"
  1527. Locale["sk"]["examples"] = "Príklady"
  1528. Locale["sk"]["see-also"] = "Pozrite tiež"
  1529. Locale["sk"]["family"] = "Indo-European"
  1530. Locale["sk"]["iso"] = "slk"
  1531. Locale["sk"]["glotto"] = "slov1269"
  1532. Locale["sk"]["script"] = "Latn"
  1533. Locale["sl"]["name"] = "Slovenian"
  1534. Locale["sl"]["endonym"] = "Slovenščina"
  1535. Locale["sl"]["translations-of"] = "Prevodi za %s"
  1536. Locale["sl"]["definitions-of"] = "Razlage za %s"
  1537. Locale["sl"]["synonyms"] = "Sopomenke"
  1538. Locale["sl"]["examples"] = "Primeri"
  1539. Locale["sl"]["see-also"] = "Glejte tudi"
  1540. Locale["sl"]["family"] = "Indo-European"
  1541. Locale["sl"]["iso"] = "slv"
  1542. Locale["sl"]["glotto"] = "slov1268"
  1543. Locale["sl"]["script"] = "Latn"
  1544. Locale["so"]["name"] = "Somali"
  1545. Locale["so"]["endonym"] = "Soomaali"
  1546. Locale["so"]["translations-of"] = "Turjumaada %s"
  1547. Locale["so"]["definitions-of"] = "Qeexitaannada %s"
  1548. Locale["so"]["synonyms"] = "La micne ah"
  1549. Locale["so"]["examples"] = "Tusaalooyin"
  1550. Locale["so"]["see-also"] = "Sidoo kale eeg"
  1551. Locale["so"]["family"] = "Afro-Asiatic"
  1552. Locale["so"]["iso"] = "som"
  1553. Locale["so"]["glotto"] = "soma1255"
  1554. Locale["so"]["script"] = "Latn"
  1555. Locale["es"]["name"] = "Spanish"
  1556. Locale["es"]["endonym"] = "Español"
  1557. Locale["es"]["translations-of"] = "Traducciones de %s"
  1558. Locale["es"]["definitions-of"] = "Definiciones de %s"
  1559. Locale["es"]["synonyms"] = "Sinónimos"
  1560. Locale["es"]["examples"] = "Ejemplos"
  1561. Locale["es"]["see-also"] = "Ver también"
  1562. Locale["es"]["family"] = "Indo-European"
  1563. Locale["es"]["iso"] = "spa"
  1564. Locale["es"]["glotto"] = "stan1288"
  1565. Locale["es"]["script"] = "Latn"
  1566. Locale["es"]["dictionary"] = "true"
  1567. Locale["su"]["name"] = "Sundanese"
  1568. Locale["su"]["endonym"] = "Basa Sunda"
  1569. Locale["su"]["translations-of"] = "Tarjamahan tina %s"
  1570. Locale["su"]["definitions-of"] = "Panjelasan tina %s"
  1571. Locale["su"]["synonyms"] = "Sinonim"
  1572. Locale["su"]["examples"] = "Conto"
  1573. Locale["su"]["see-also"] = "Tingali ogé"
  1574. Locale["su"]["family"] = "Austronesian"
  1575. Locale["su"]["iso"] = "sun"
  1576. Locale["su"]["glotto"] = "sund1252"
  1577. Locale["su"]["script"] = "Latn"
  1578. Locale["sw"]["name"] = "Swahili"
  1579. Locale["sw"]["endonym"] = "Kiswahili"
  1580. Locale["sw"]["translations-of"] = "Tafsiri ya %s"
  1581. Locale["sw"]["definitions-of"] = "Ufafanuzi wa %s"
  1582. Locale["sw"]["synonyms"] = "Visawe"
  1583. Locale["sw"]["examples"] = "Mifano"
  1584. Locale["sw"]["see-also"] = "Angalia pia"
  1585. Locale["sw"]["family"] = "Atlantic-Congo"
  1586. Locale["sw"]["iso"] = "swa"
  1587. Locale["sw"]["glotto"] = "swah1253"
  1588. Locale["sw"]["script"] = "Latn"
  1589. Locale["sv"]["name"] = "Swedish"
  1590. Locale["sv"]["endonym"] = "Svenska"
  1591. Locale["sv"]["translations-of"] = "Översättningar av %s"
  1592. Locale["sv"]["definitions-of"] = "Definitioner av %s"
  1593. Locale["sv"]["synonyms"] = "Synonymer"
  1594. Locale["sv"]["examples"] = "Exempel"
  1595. Locale["sv"]["see-also"] = "Se även"
  1596. Locale["sv"]["family"] = "Indo-European"
  1597. Locale["sv"]["iso"] = "swe"
  1598. Locale["sv"]["glotto"] = "swed1254"
  1599. Locale["sv"]["script"] = "Latn"
  1600. Locale["tg"]["name"] = "Tajik"
  1601. Locale["tg"]["endonym"] = "Тоҷикӣ"
  1602. Locale["tg"]["translations-of"] = "Тарҷумаҳои %s"
  1603. Locale["tg"]["definitions-of"] = "Таърифҳои %s"
  1604. Locale["tg"]["synonyms"] = "Муродифҳо"
  1605. Locale["tg"]["examples"] = "Намунаҳо:"
  1606. Locale["tg"]["see-also"] = "Ҳамчунин Бинед"
  1607. Locale["tg"]["family"] = "Indo-European"
  1608. Locale["tg"]["iso"] = "tgk"
  1609. Locale["tg"]["glotto"] = "taji1245"
  1610. Locale["tg"]["script"] = "Cyrl"
  1611. Locale["ta"]["name"] = "Tamil"
  1612. Locale["ta"]["endonym"] = "தமிழ்"
  1613. Locale["ta"]["translations-of"] = "%s இன் மொழிபெயர்ப்புகள்"
  1614. Locale["ta"]["definitions-of"] = "%s இன் வரையறைகள்"
  1615. Locale["ta"]["synonyms"] = "இணைச்சொற்கள்"
  1616. Locale["ta"]["examples"] = "எடுத்துக்காட்டுகள்"
  1617. Locale["ta"]["see-also"] = "இதையும் காண்க"
  1618. Locale["ta"]["family"] = "Dravidian"
  1619. Locale["ta"]["iso"] = "tam"
  1620. Locale["ta"]["glotto"] = "tami1289"
  1621. Locale["ta"]["script"] = "Taml"
  1622. Locale["te"]["name"] = "Telugu"
  1623. Locale["te"]["endonym"] = "తెలుగు"
  1624. Locale["te"]["translations-of"] = "%s యొక్క అనువాదాలు"
  1625. Locale["te"]["definitions-of"] = "%s యొక్క నిర్వచనాలు"
  1626. Locale["te"]["synonyms"] = "పర్యాయపదాలు"
  1627. Locale["te"]["examples"] = "ఉదాహరణలు"
  1628. Locale["te"]["see-also"] = "వీటిని కూడా చూడండి"
  1629. Locale["te"]["family"] = "Dravidian"
  1630. Locale["te"]["iso"] = "tel"
  1631. Locale["te"]["glotto"] = "telu1262"
  1632. Locale["te"]["script"] = "Telu"
  1633. Locale["th"]["name"] = "Thai"
  1634. Locale["th"]["endonym"] = "ไทย"
  1635. Locale["th"]["translations-of"] = "คำแปลของ %s"
  1636. Locale["th"]["definitions-of"] = "คำจำกัดความของ %s"
  1637. Locale["th"]["synonyms"] = "คำพ้องความหมาย"
  1638. Locale["th"]["examples"] = "ตัวอย่าง"
  1639. Locale["th"]["see-also"] = "ดูเพิ่มเติม"
  1640. Locale["th"]["family"] = "Tai-Kadai"
  1641. Locale["th"]["iso"] = "tha"
  1642. Locale["th"]["glotto"] = "thai1261"
  1643. Locale["th"]["script"] = "Thai"
  1644. Locale["tr"]["name"] = "Turkish"
  1645. Locale["tr"]["endonym"] = "Türkçe"
  1646. Locale["tr"]["translations-of"] = "%s çevirileri"
  1647. Locale["tr"]["definitions-of"] = "%s için tanımlar"
  1648. Locale["tr"]["synonyms"] = "Eş anlamlılar"
  1649. Locale["tr"]["examples"] = "Örnekler"
  1650. Locale["tr"]["see-also"] = "Ayrıca bkz."
  1651. Locale["tr"]["family"] = "Turkic"
  1652. Locale["tr"]["iso"] = "tur"
  1653. Locale["tr"]["glotto"] = "nucl1301"
  1654. Locale["tr"]["script"] = "Latn"
  1655. Locale["uk"]["name"] = "Ukrainian"
  1656. Locale["uk"]["endonym"] = "Українська"
  1657. Locale["uk"]["translations-of"] = "Переклади слова або виразу \"%s\""
  1658. Locale["uk"]["definitions-of"] = "\"%s\" – визначення"
  1659. Locale["uk"]["synonyms"] = "Синоніми"
  1660. Locale["uk"]["examples"] = "Приклади"
  1661. Locale["uk"]["see-also"] = "Дивіться також"
  1662. Locale["uk"]["family"] = "Indo-European"
  1663. Locale["uk"]["iso"] = "ukr"
  1664. Locale["uk"]["glotto"] = "ukra1253"
  1665. Locale["uk"]["script"] = "Cyrl"
  1666. Locale["ur"]["name"] = "Urdu"
  1667. Locale["ur"]["endonym"] = "اُردُو"
  1668. Locale["ur"]["translations-of"] = "کے ترجمے %s"
  1669. Locale["ur"]["definitions-of"] = "کی تعریفات %s"
  1670. Locale["ur"]["synonyms"] = "مترادفات"
  1671. Locale["ur"]["examples"] = "مثالیں"
  1672. Locale["ur"]["see-also"] = "نیز دیکھیں"
  1673. Locale["ur"]["family"] = "Indo-European"
  1674. Locale["ur"]["iso"] = "urd"
  1675. Locale["ur"]["glotto"] = "urdu1245"
  1676. Locale["ur"]["script"] = "Arab"
  1677. Locale["ur"]["rtl"] = "true"
  1678. Locale["uz"]["name"] = "Uzbek"
  1679. Locale["uz"]["endonym"] = "Oʻzbek tili"
  1680. Locale["uz"]["translations-of"] = "%s: tarjima variantlari"
  1681. Locale["uz"]["definitions-of"] = "%s – ta’riflar"
  1682. Locale["uz"]["synonyms"] = "Sinonimlar"
  1683. Locale["uz"]["examples"] = "Namunalar"
  1684. Locale["uz"]["see-also"] = "O‘xshash so‘zlar"
  1685. Locale["uz"]["family"] = "Turkic"
  1686. Locale["uz"]["iso"] = "uzb"
  1687. Locale["uz"]["glotto"] = "uzbe1247"
  1688. Locale["uz"]["script"] = "Latn"
  1689. Locale["vi"]["name"] = "Vietnamese"
  1690. Locale["vi"]["endonym"] = "Tiếng Việt"
  1691. Locale["vi"]["translations-of"] = "Bản dịch của %s"
  1692. Locale["vi"]["definitions-of"] = "Nghĩa của %s"
  1693. Locale["vi"]["synonyms"] = "Từ đồng nghĩa"
  1694. Locale["vi"]["examples"] = "Ví dụ"
  1695. Locale["vi"]["see-also"] = "Xem thêm"
  1696. Locale["vi"]["family"] = "Austroasiatic"
  1697. Locale["vi"]["iso"] = "vie"
  1698. Locale["vi"]["glotto"] = "viet1252"
  1699. Locale["vi"]["script"] = "Latn"
  1700. Locale["cy"]["name"] = "Welsh"
  1701. Locale["cy"]["endonym"] = "Cymraeg"
  1702. Locale["cy"]["translations-of"] = "Cyfieithiadau %s"
  1703. Locale["cy"]["definitions-of"] = "Diffiniadau %s"
  1704. Locale["cy"]["synonyms"] = "Cyfystyron"
  1705. Locale["cy"]["examples"] = "Enghreifftiau"
  1706. Locale["cy"]["see-also"] = "Gweler hefyd"
  1707. Locale["cy"]["family"] = "Indo-European"
  1708. Locale["cy"]["iso"] = "cym"
  1709. Locale["cy"]["glotto"] = "wels1247"
  1710. Locale["cy"]["script"] = "Latn"
  1711. Locale["fy"]["name"] = "Frisian"
  1712. Locale["fy"]["endonym"] = "Frysk"
  1713. Locale["fy"]["translations-of"] = "Oersettings fan %s"
  1714. Locale["fy"]["definitions-of"] = "Definysjes fan %s"
  1715. Locale["fy"]["synonyms"] = "Synonimen"
  1716. Locale["fy"]["examples"] = "Foarbylden"
  1717. Locale["fy"]["see-also"] = "Sjoch ek"
  1718. Locale["fy"]["family"] = "Indo-European"
  1719. Locale["fy"]["iso"] = "fry"
  1720. Locale["fy"]["glotto"] = "west2354"
  1721. Locale["fy"]["script"] = "Latn"
  1722. Locale["xh"]["name"] = "Xhosa"
  1723. Locale["xh"]["endonym"] = "isiXhosa"
  1724. Locale["xh"]["translations-of"] = "Iinguqulelo zika-%s"
  1725. Locale["xh"]["definitions-of"] = "Iingcaciso zika-%s"
  1726. Locale["xh"]["synonyms"] = "Izithethantonye"
  1727. Locale["xh"]["examples"] = "Imizekelo"
  1728. Locale["xh"]["see-also"] = "Kwakhona bona"
  1729. Locale["xh"]["family"] = "Atlantic-Congo"
  1730. Locale["xh"]["iso"] = "xho"
  1731. Locale["xh"]["glotto"] = "xhos1239"
  1732. Locale["xh"]["script"] = "Latn"
  1733. Locale["yi"]["name"] = "Yiddish"
  1734. Locale["yi"]["endonym"] = "ייִדיש"
  1735. Locale["yi"]["translations-of"] = "איבערזעצונגען פון %s"
  1736. Locale["yi"]["definitions-of"] = "דפיניציונען %s"
  1737. Locale["yi"]["synonyms"] = "סינאָנימען"
  1738. Locale["yi"]["examples"] = "ביישפילע"
  1739. Locale["yi"]["see-also"] = "זייען אויך"
  1740. Locale["yi"]["family"] = "Indo-European"
  1741. Locale["yi"]["iso"] = "yid"
  1742. Locale["yi"]["glotto"] = "yidd1255"
  1743. Locale["yi"]["script"] = "Hebr"
  1744. Locale["yi"]["rtl"] = "true"
  1745. Locale["yo"]["name"] = "Yoruba"
  1746. Locale["yo"]["endonym"] = "Yorùbá"
  1747. Locale["yo"]["translations-of"] = "Awọn itumọ ti %s"
  1748. Locale["yo"]["definitions-of"] = "Awọn itumọ ti %s"
  1749. Locale["yo"]["synonyms"] = "Awọn ọrọ onitumọ"
  1750. Locale["yo"]["examples"] = "Awọn apẹrẹ"
  1751. Locale["yo"]["see-also"] = "Tun wo"
  1752. Locale["yo"]["family"] = "Atlantic-Congo"
  1753. Locale["yo"]["iso"] = "yor"
  1754. Locale["yo"]["glotto"] = "yoru1245"
  1755. Locale["yo"]["script"] = "Latn"
  1756. Locale["zu"]["name"] = "Zulu"
  1757. Locale["zu"]["endonym"] = "isiZulu"
  1758. Locale["zu"]["translations-of"] = "Ukuhumusha i-%s"
  1759. Locale["zu"]["definitions-of"] = "Izincazelo ze-%s"
  1760. Locale["zu"]["synonyms"] = "Amagama afanayo"
  1761. Locale["zu"]["examples"] = "Izibonelo"
  1762. Locale["zu"]["see-also"] = "Bheka futhi"
  1763. Locale["zu"]["family"] = "Atlantic-Congo"
  1764. Locale["zu"]["iso"] = "zul"
  1765. Locale["zu"]["glotto"] = "zulu1248"
  1766. Locale["zu"]["script"] = "Latn"
  1767. Locale["yue"]["support"] = "bing-only"
  1768. Locale["yue"]["name"] = "Cantonese"
  1769. Locale["yue"]["endonym"] = "粵語"
  1770. Locale["yue"]["family"] = "Sino-Tibetan"
  1771. Locale["yue"]["iso"] = "yue"
  1772. Locale["yue"]["glotto"] = "cant1236"
  1773. Locale["yue"]["script"] = "Hant"
  1774. Locale["fj"]["support"] = "bing-only"
  1775. Locale["fj"]["name"] = "Fijian"
  1776. Locale["fj"]["endonym"] = "Vosa Vakaviti"
  1777. Locale["fj"]["family"] = "Austronesian"
  1778. Locale["fj"]["iso"] = "fij"
  1779. Locale["fj"]["glotto"] = "fiji1243"
  1780. Locale["fj"]["script"] = "Latn"
  1781. Locale["mww"]["support"] = "bing-only"
  1782. Locale["mww"]["name"] = "Hmong Daw"
  1783. Locale["mww"]["endonym"] = "Hmoob Daw"
  1784. Locale["mww"]["family"] = "Hmong-Mien"
  1785. Locale["mww"]["iso"] = "mww"
  1786. Locale["mww"]["glotto"] = "hmon1333"
  1787. Locale["mww"]["script"] = "Latn"
  1788. Locale["otq"]["support"] = "bing-only"
  1789. Locale["otq"]["name"] = "Querétaro Otomi"
  1790. Locale["otq"]["endonym"] = "Hñąñho"
  1791. Locale["otq"]["family"] = "Oto-Manguean"
  1792. Locale["otq"]["iso"] = "otq"
  1793. Locale["otq"]["glotto"] = "quer1236"
  1794. Locale["otq"]["script"] = "Latn"
  1795. Locale["ty"]["support"] = "bing-only"
  1796. Locale["ty"]["name"] = "Tahitian"
  1797. Locale["ty"]["endonym"] = "Reo Tahiti"
  1798. Locale["ty"]["family"] = "Austronesian"
  1799. Locale["ty"]["iso"] = "tah"
  1800. Locale["ty"]["glotto"] = "tahi1242"
  1801. Locale["ty"]["script"] = "Latn"
  1802. Locale["to"]["support"] = "bing-only"
  1803. Locale["to"]["name"] = "Tongan"
  1804. Locale["to"]["endonym"] = "Lea faka-Tonga"
  1805. Locale["to"]["family"] = "Austronesian"
  1806. Locale["to"]["iso"] = "ton"
  1807. Locale["to"]["glotto"] = "tong1325"
  1808. Locale["to"]["script"] = "Latn"
  1809. Locale["yua"]["support"] = "bing-only"
  1810. Locale["yua"]["name"] = "Yucatec Maya"
  1811. Locale["yua"]["endonym"] = "Màaya T'àan"
  1812. Locale["yua"]["family"] = "Mayan"
  1813. Locale["yua"]["iso"] = "yua"
  1814. Locale["yua"]["glotto"] = "yuca1254"
  1815. Locale["yua"]["script"] = "Latn"
  1816. Locale["tlh"]["support"] = "bing-only"
  1817. Locale["tlh"]["name"] = "Klingon"
  1818. Locale["tlh"]["endonym"] = "tlhIngan Hol"
  1819. Locale["tlh"]["family"] = "Artificial Language"
  1820. Locale["tlh"]["iso"] = "tlh"
  1821. Locale["tlh"]["script"] = "Latn"
  1822. Locale["tlh-Qaak"]["support"] = "bing-only"
  1823. Locale["tlh-Qaak"]["name"] = "Klingon (pIqaD)"
  1824. Locale["tlh-Qaak"]["endonym"] = " "
  1825. Locale["tlh-Qaak"]["family"] = "Artificial Language"
  1826. Locale["tlh-Qaak"]["iso"] = "tlh"
  1827. Locale["tlh-Qaak"]["script"] = "Piqd"
  1828. Locale["as"]["support"] = "unstable"
  1829. Locale["as"]["name"] = "Assamese"
  1830. Locale["as"]["endonym"] = "অসমীয়া"
  1831. Locale["as"]["family"] = "Indo-European"
  1832. Locale["as"]["iso"] = "asm"
  1833. Locale["as"]["glotto"] = "assa1263"
  1834. Locale["as"]["script"] = "Beng"
  1835. Locale["ba"]["support"] = "yandex-only"
  1836. Locale["ba"]["name"] = "Bashkir"
  1837. Locale["ba"]["endonym"] = "башҡорт теле"
  1838. Locale["ba"]["family"] = "Turkic"
  1839. Locale["ba"]["iso"] = "bak"
  1840. Locale["ba"]["glotto"] = "bash1264"
  1841. Locale["ba"]["script"] = "Cyrl"
  1842. Locale["br"]["support"] = "unstable"
  1843. Locale["br"]["name"] = "Breton"
  1844. Locale["br"]["endonym"] = "Brezhoneg"
  1845. Locale["br"]["family"] = "Indo-European"
  1846. Locale["br"]["iso"] = "bre"
  1847. Locale["br"]["glotto"] = "bret1244"
  1848. Locale["br"]["script"] = "Latn"
  1849. Locale["dz"]["support"] = "unstable"
  1850. Locale["dz"]["name"] = "Dzongkha"
  1851. Locale["dz"]["endonym"] = "རྫོང་ཁ"
  1852. Locale["dz"]["family"] = "Sino-Tibetan"
  1853. Locale["dz"]["iso"] = "dzo"
  1854. Locale["dz"]["glotto"] = "nucl1307"
  1855. Locale["dz"]["script"] = "Tibt"
  1856. Locale["mhr"]["support"] = "yandex-only"
  1857. Locale["mhr"]["name"] = "Eastern Mari"
  1858. Locale["mhr"]["endonym"] = "Олык марий"
  1859. Locale["mhr"]["family"] = "Uralic"
  1860. Locale["mhr"]["iso"] = "mhr"
  1861. Locale["mhr"]["glotto"] = "east2328"
  1862. Locale["mhr"]["script"] = "Cyrl"
  1863. Locale["fo"]["support"] = "unstable"
  1864. Locale["fo"]["name"] = "Faroese"
  1865. Locale["fo"]["endonym"] = "Føroyskt"
  1866. Locale["fo"]["family"] = "Indo-European"
  1867. Locale["fo"]["iso"] = "fao"
  1868. Locale["fo"]["glotto"] = "faro1244"
  1869. Locale["fo"]["script"] = "Latn"
  1870. Locale["gn"]["support"] = "unstable"
  1871. Locale["gn"]["name"] = "Guarani"
  1872. Locale["gn"]["endonym"] = "Avañe'ẽ"
  1873. Locale["gn"]["family"] = "Tupian"
  1874. Locale["gn"]["iso"] = "grn"
  1875. Locale["gn"]["glotto"] = "para1311"
  1876. Locale["gn"]["script"] = "Latn"
  1877. Locale["mrj"]["support"] = "yandex-only"
  1878. Locale["mrj"]["name"] = "Hill Mari"
  1879. Locale["mrj"]["endonym"] = "Кырык мары"
  1880. Locale["mrj"]["family"] = "Uralic"
  1881. Locale["mrj"]["iso"] = "mrj"
  1882. Locale["mrj"]["glotto"] = "west2392"
  1883. Locale["mrj"]["script"] = "Cyrl"
  1884. Locale["ie"]["support"] = "unstable"
  1885. Locale["ie"]["name"] = "Interlingue"
  1886. Locale["ie"]["endonym"] = "Interlingue"
  1887. Locale["ie"]["family"] = "Artificial Language"
  1888. Locale["ie"]["iso"] = "ile"
  1889. Locale["ie"]["glotto"] = "occi1241"
  1890. Locale["ie"]["script"] = "Latn"
  1891. Locale["rw"]["support"] = "unstable"
  1892. Locale["rw"]["name"] = "Kinyarwanda"
  1893. Locale["rw"]["endonym"] = "Ikinyarwanda"
  1894. Locale["rw"]["family"] = "Atlantic-Congo"
  1895. Locale["rw"]["iso"] = "kin"
  1896. Locale["rw"]["glotto"] = "kiny1244"
  1897. Locale["rw"]["script"] = "Latn"
  1898. Locale["oc"]["support"] = "unstable"
  1899. Locale["oc"]["name"] = "Occitan"
  1900. Locale["oc"]["endonym"] = "Occitan"
  1901. Locale["oc"]["family"] = "Indo-European"
  1902. Locale["oc"]["iso"] = "oci"
  1903. Locale["oc"]["glotto"] = "occi1239"
  1904. Locale["oc"]["script"] = "Latn"
  1905. Locale["om"]["support"] = "unstable"
  1906. Locale["om"]["name"] = "Oromo"
  1907. Locale["om"]["endonym"] = "Afaan Oromoo"
  1908. Locale["om"]["family"] = "Afro-Asiatic"
  1909. Locale["om"]["iso"] = "orm"
  1910. Locale["om"]["glotto"] = "nucl1736"
  1911. Locale["om"]["script"] = "Latn"
  1912. Locale["or"]["support"] = "unstable"
  1913. Locale["or"]["name"] = "Oriya"
  1914. Locale["or"]["endonym"] = "ଓଡ଼ିଆ"
  1915. Locale["or"]["family"] = "Indo-European"
  1916. Locale["or"]["iso"] = "ori"
  1917. Locale["or"]["glotto"] = "macr1269"
  1918. Locale["or"]["script"] = "Orya"
  1919. Locale["pap"]["support"] = "yandex-only"
  1920. Locale["pap"]["name"] = "Papiamento"
  1921. Locale["pap"]["endonym"] = "Papiamentu"
  1922. Locale["pap"]["family"] = "Indo-European"
  1923. Locale["pap"]["iso"] = "pap"
  1924. Locale["pap"]["glotto"] = "papi1253"
  1925. Locale["pap"]["script"] = "Latn"
  1926. Locale["rm"]["support"] = "unstable"
  1927. Locale["rm"]["name"] = "Romansh"
  1928. Locale["rm"]["endonym"] = "Rumantsch"
  1929. Locale["rm"]["family"] = "Indo-European"
  1930. Locale["rm"]["iso"] = "roh"
  1931. Locale["rm"]["glotto"] = "roma1326"
  1932. Locale["rm"]["script"] = "Latn"
  1933. Locale["ti"]["support"] = "unstable"
  1934. Locale["ti"]["name"] = "Tigrinya"
  1935. Locale["ti"]["endonym"] = "ትግርኛ"
  1936. Locale["ti"]["family"] = "Afro-Asiatic"
  1937. Locale["ti"]["iso"] = "tir"
  1938. Locale["ti"]["glotto"] = "tigr1271"
  1939. Locale["ti"]["script"] = "Ethi"
  1940. Locale["bo"]["support"] = "unstable"
  1941. Locale["bo"]["name"] = "Tibetan"
  1942. Locale["bo"]["endonym"] = "བོད་ཡིག"
  1943. Locale["bo"]["family"] = "Sino-Tibetan"
  1944. Locale["bo"]["iso"] = "bod"
  1945. Locale["bo"]["glotto"] = "tibe1272"
  1946. Locale["bo"]["script"] = "Tibt"
  1947. Locale["tk"]["support"] = "unstable"
  1948. Locale["tk"]["name"] = "Turkmen"
  1949. Locale["tk"]["endonym"] = "Türkmen"
  1950. Locale["tk"]["family"] = "Turkic"
  1951. Locale["tk"]["iso"] = "tuk"
  1952. Locale["tk"]["glotto"] = "turk1304"
  1953. Locale["tk"]["script"] = "Latn"
  1954. Locale["tt"]["support"] = "yandex-only"
  1955. Locale["tt"]["name"] = "Tatar"
  1956. Locale["tt"]["endonym"] = "татарча"
  1957. Locale["tt"]["family"] = "Turkic"
  1958. Locale["tt"]["iso"] = "tat"
  1959. Locale["tt"]["glotto"] = "tata1255"
  1960. Locale["tt"]["script"] = "Cyrl"
  1961. Locale["udm"]["support"] = "yandex-only"
  1962. Locale["udm"]["name"] = "Udmurt"
  1963. Locale["udm"]["endonym"] = "удмурт"
  1964. Locale["udm"]["family"] = "Uralic"
  1965. Locale["udm"]["iso"] = "udm"
  1966. Locale["udm"]["glotto"] = "udmu1245"
  1967. Locale["udm"]["script"] = "Cyrl"
  1968. Locale["ug"]["support"] = "unstable"
  1969. Locale["ug"]["name"] = "Uyghur"
  1970. Locale["ug"]["endonym"] = "ئۇيغۇر تىلى"
  1971. Locale["ug"]["family"] = "Turkic"
  1972. Locale["ug"]["iso"] = "uig"
  1973. Locale["ug"]["glotto"] = "uigh1240"
  1974. Locale["ug"]["script"] = "Arab"
  1975. Locale["ug"]["rtl"] = "true"
  1976. Locale["vo"]["support"] = "unstable"
  1977. Locale["vo"]["name"] = "Volapük"
  1978. Locale["vo"]["endonym"] = "Volapük"
  1979. Locale["vo"]["family"] = "Artificial Language"
  1980. Locale["vo"]["iso"] = "vol"
  1981. Locale["vo"]["script"] = "Latn"
  1982. Locale["wo"]["support"] = "unstable"
  1983. Locale["wo"]["name"] = "Wolof"
  1984. Locale["wo"]["endonym"] = "Wollof"
  1985. Locale["wo"]["family"] = "Atlantic-Congo"
  1986. Locale["wo"]["iso"] = "wol"
  1987. Locale["wo"]["glotto"] = "wolo1247"
  1988. Locale["wo"]["script"] = "Latn"
  1989. Locale["chr"]["support"] = "unstable"
  1990. Locale["chr"]["name"] = "Cherokee"
  1991. Locale["chr"]["endonym"] = "ᏣᎳᎩ"
  1992. Locale["chr"]["family"] = "Iroquoian"
  1993. Locale["chr"]["iso"] = "chr"
  1994. Locale["chr"]["glotto"] = "cher1273"
  1995. Locale["chr"]["script"] = "Cher"
  1996. for (i in Locale) {
  1997. Locale[i]["display"] = show(Locale[i]["endonym"], i)
  1998. LocaleAlias[Locale[i]["iso"]] = i
  1999. LocaleAlias[tolower(Locale[i]["name"])] = i
  2000. LocaleAlias[tolower(Locale[i]["endonym"])] = i
  2001. }
  2002. LocaleAlias["in"] = "id"
  2003. LocaleAlias["iw"] = "he"
  2004. LocaleAlias["ji"] = "yi"
  2005. LocaleAlias["jw"] = "jv"
  2006. LocaleAlias["mo"] = "ro"
  2007. LocaleAlias["nb"] = "no"
  2008. LocaleAlias["nn"] = "no"
  2009. LocaleAlias["sh"] = "sr-Cyrl"
  2010. LocaleAlias["sr"] = "sr-Cyrl"
  2011. LocaleAlias["srp"] = "sr-Cyrl"
  2012. LocaleAlias["serbian"] = "sr-Cyrl"
  2013. LocaleAlias["zh"] = "zh-CN"
  2014. LocaleAlias["zh-CHS"] = "zh-CN"
  2015. LocaleAlias["zh-CHT"] = "zh-TW"
  2016. LocaleAlias["zho"] = "zh-CN"
  2017. LocaleAlias["chinese"] = "zh-CN"
  2018. LocaleAlias["tlh-Latn"] = "tlh"
  2019. LocaleAlias["tlh-Piqd"] = "tlh-Qaak"
  2020. }
  2021. function getCode(code, group) {
  2022. if (code == "auto" || code in Locale)
  2023. return code
  2024. else if (code in LocaleAlias)
  2025. return LocaleAlias[code]
  2026. else if (tolower(code) in LocaleAlias)
  2027. return LocaleAlias[tolower(code)]
  2028. match(code, /^([[:alpha:]][[:alpha:]][[:alpha:]]?)-(.*)$/, group)
  2029. if (group[1])
  2030. return group[1]
  2031. return
  2032. }
  2033. function getName(code) {
  2034. return Locale[getCode(code)]["name"]
  2035. }
  2036. function getEndonym(code) {
  2037. return Locale[getCode(code)]["endonym"]
  2038. }
  2039. function getDisplay(code) {
  2040. return Locale[getCode(code)]["display"]
  2041. }
  2042. function showTranslationsOf(code, text, fmt) {
  2043. fmt = Locale[getCode(code)]["translations-of"]
  2044. if (!fmt) fmt = Locale["en"]["translations-of"]
  2045. return sprintf(fmt, text)
  2046. }
  2047. function showDefinitionsOf(code, text, fmt) {
  2048. fmt = Locale[getCode(code)]["definitions-of"]
  2049. if (!fmt) fmt = Locale["en"]["definitions-of"]
  2050. return sprintf(fmt, text)
  2051. }
  2052. function showSynonyms(code, tmp) {
  2053. tmp = Locale[getCode(code)]["synonyms"]
  2054. if (!tmp) tmp = Locale["en"]["synonyms"]
  2055. return tmp
  2056. }
  2057. function showExamples(code, tmp) {
  2058. tmp = Locale[getCode(code)]["examples"]
  2059. if (!tmp) tmp = Locale["en"]["examples"]
  2060. return tmp
  2061. }
  2062. function showSeeAlso(code, tmp) {
  2063. tmp = Locale[getCode(code)]["see-also"]
  2064. if (!tmp) tmp = Locale["en"]["see-also"]
  2065. return tmp
  2066. }
  2067. function getFamily(code) {
  2068. return Locale[getCode(code)]["family"]
  2069. }
  2070. function getISO(code) {
  2071. return Locale[getCode(code)]["iso"]
  2072. }
  2073. function getGlotto(code) {
  2074. return Locale[getCode(code)]["glotto"]
  2075. }
  2076. function getScript(code) {
  2077. return Locale[getCode(code)]["script"]
  2078. }
  2079. function isRTL(code) {
  2080. return Locale[getCode(code)]["rtl"] ? 1 : 0
  2081. }
  2082. function hasDictionary(code) {
  2083. return Locale[getCode(code)]["dictionary"] ? 1 : 0
  2084. }
  2085. function compName(i1, v1, i2, v2) {
  2086. if (getName(i1) < getName(i2))
  2087. return -1
  2088. else
  2089. return (getName(i1) != getName(i2))
  2090. }
  2091. function scriptName(code) {
  2092. switch (code) {
  2093. case "Arab": return "Arabic"
  2094. case "Armn": return "Armenian"
  2095. case "Beng": return "Bengali"
  2096. case "Cher": return "Cherokee"
  2097. case "Cyrl": return "Cyrillic"
  2098. case "Deva": return "Devanagari"
  2099. case "Ethi": return "Ethiopic (Geʻez)"
  2100. case "Geor": return "Georgian (Mkhedruli)"
  2101. case "Grek": return "Greek"
  2102. case "Gujr": return "Gujarati"
  2103. case "Guru": return "Gurmukhi"
  2104. case "Hani": return "Han"
  2105. case "Hans": return "Han (Simplified)"
  2106. case "Hant": return "Han (Traditional)"
  2107. case "Hebr": return "Hebrew"
  2108. case "Jpan": return "Japanese (Han + Hiragana + Katakana)"
  2109. case "Khmr": return "Khmer"
  2110. case "Knda": return "Kannada"
  2111. case "Kore": return "Korean (Hangul + Han)"
  2112. case "Laoo": return "Lao"
  2113. case "Latn": return "Latin"
  2114. case "Mlym": return "Malayalam"
  2115. case "Mymr": return "Myanmar"
  2116. case "Orya": return "Oriya"
  2117. case "Piqd": return "Klingon (pIqaD)"
  2118. case "Sinh": return "Sinhala"
  2119. case "Taml": return "Tamil"
  2120. case "Telu": return "Telugu"
  2121. case "Thai": return "Thai"
  2122. case "Tibt": return "Tibetan"
  2123. default: return "Unknown"
  2124. }
  2125. }
  2126. function getDetails(code, group, iso, language, script) {
  2127. if (code == "auto" || !getCode(code)) {
  2128. e("[ERROR] Language not found: " code "\n"\
  2129. " Run '-reference / -R' to see a list of available languages.")
  2130. exit 1
  2131. }
  2132. script = scriptName(getScript(code))
  2133. if (isRTL(code)) script = script " (R-to-L)"
  2134. split(getISO(code), group, "-")
  2135. iso = group[1]
  2136. split(getName(code), group, " ")
  2137. language = length(group) == 1 ? group[1] "_language" :
  2138. group[2] ~ /^\(.*\)$/ ? group[1] "_language" : join(group, "_")
  2139. return ansi("bold", sprintf("%s\n", getDisplay(code)))\
  2140. sprintf("%-22s%s\n", "Name", ansi("bold", getName(code)))\
  2141. sprintf("%-22s%s\n", "Family", ansi("bold", getFamily(code)))\
  2142. sprintf("%-22s%s\n", "Writing system", ansi("bold", script))\
  2143. sprintf("%-22s%s\n", "Code", ansi("bold", getCode(code)))\
  2144. sprintf("%-22s%s\n", "ISO 639-3", ansi("bold", iso))\
  2145. sprintf("%-22s%s\n", "SIL", ansi("bold", "http://www-01.sil.org/iso639-3/documentation.asp?id=" iso))\
  2146. sprintf("%-22s%s\n", "Glottolog", getGlotto(code) ?
  2147. ansi("bold", "http://glottolog.org/resource/languoid/id/" getGlotto(code)) : "")\
  2148. sprintf("%-22s%s", "Wikipedia", ansi("bold", "http://en.wikipedia.org/wiki/" language))
  2149. }
  2150. function showPhonetics(phonetics, code) {
  2151. if (code && getCode(code) == "en")
  2152. return "/" phonetics "/"
  2153. else
  2154. return "(" phonetics ")"
  2155. }
  2156. function show(text, code, temp) {
  2157. if (!code || isRTL(code)) {
  2158. if (Cache[text][0])
  2159. return Cache[text][0]
  2160. else {
  2161. if ((FriBidi || (code && isRTL(code))) && BiDiNoPad)
  2162. ("echo " parameterize(text) PIPE BiDiNoPad) | getline temp
  2163. else
  2164. temp = text
  2165. return Cache[text][0] = temp
  2166. }
  2167. } else
  2168. return text
  2169. }
  2170. function s(text, code, width, temp) {
  2171. if (!code || isRTL(code)) {
  2172. if (!width) width = Option["width"]
  2173. if (Cache[text][width])
  2174. return Cache[text][width]
  2175. else {
  2176. if ((FriBidi || (code && isRTL(code))) && BiDi)
  2177. ("echo " parameterize(text) PIPE sprintf(BiDi, width)) | getline temp
  2178. else
  2179. temp = text
  2180. return Cache[text][width] = temp
  2181. }
  2182. } else
  2183. return text
  2184. }
  2185. function ins(level, text, code, width, i, temp) {
  2186. if (code && isRTL(code)) {
  2187. if (!width) width = Option["width"]
  2188. return s(text, code, width - Option["indent"] * level)
  2189. } else
  2190. return replicate(" ", Option["indent"] * level) text
  2191. }
  2192. function parseLang(lang, code, group) {
  2193. match(lang, /^([a-z][a-z][a-z]?)(_|$)/, group)
  2194. code = getCode(group[1])
  2195. if (lang ~ /^zh_(CN|SG)/) code = "zh-CN"
  2196. else if (lang ~ /^zh_(TW|HK)/) code = "zh-TW"
  2197. if (!code) code = "en"
  2198. return code
  2199. }
  2200. function initUserLang( lang, utf) {
  2201. if (lang = ENVIRON["LANGUAGE"]) {
  2202. if (!UserLocale) UserLocale = lang
  2203. utf = utf || tolower(lang) ~ /utf-?8$/
  2204. }
  2205. if (lang = ENVIRON["LC_ALL"]) {
  2206. if (!UserLocale) UserLocale = lang
  2207. utf = utf || tolower(lang) ~ /utf-?8$/
  2208. }
  2209. if (lang = ENVIRON["LANG"]) {
  2210. if (!UserLocale) UserLocale = lang
  2211. utf = utf || tolower(lang) ~ /utf-?8$/
  2212. }
  2213. if (!UserLocale) {
  2214. UserLocale = "en_US.UTF-8"
  2215. utf = 1
  2216. }
  2217. if (!utf)
  2218. w("[WARNING] Your locale codeset (" UserLocale ") is not UTF-8.")
  2219. UserLang = parseLang(UserLocale)
  2220. }
  2221. function getVersion( build, gitHead, platform) {
  2222. initAudioPlayer()
  2223. initPager()
  2224. platform = detectProgram("uname", "-s", 1)
  2225. if (ENVIRON["TRANS_BUILD"])
  2226. build = "-" ENVIRON["TRANS_BUILD"]
  2227. else {
  2228. gitHead = getGitHead()
  2229. build = gitHead ? "-git:" gitHead : ""
  2230. }
  2231. return ansi("bold", sprintf("%-22s%s%s\n\n", Name, Version, build))\
  2232. sprintf("%-22s%s\n", "platform", platform)\
  2233. sprintf("%-22s%s\n", "gawk (GNU Awk)", PROCINFO["version"])\
  2234. sprintf("%s\n", FriBidi ? FriBidi :
  2235. "fribidi (GNU FriBidi) [NOT INSTALLED]")\
  2236. sprintf("%-22s%s\n", "audio player", AudioPlayer ? AudioPlayer :
  2237. "[NOT INSTALLED]")\
  2238. sprintf("%-22s%s\n", "terminal pager", Pager ? Pager :
  2239. "[NOT INSTALLED]")\
  2240. sprintf("%-22s%s\n", "terminal type", ENVIRON["TERM"])\
  2241. sprintf("%-22s%s (%s)\n", "user locale", UserLocale, getName(UserLang))\
  2242. sprintf("%-22s%s\n", "home language", Option["hl"])\
  2243. sprintf("%-22s%s\n", "source language", Option["sl"])\
  2244. sprintf("%-22s%s\n", "target language", join(Option["tl"], "+"))\
  2245. sprintf("%-22s%s\n", "translation engine", Option["engine"])\
  2246. sprintf("%-22s%s\n", "proxy", Option["proxy"] ? Option["proxy"] :
  2247. "[NONE]")\
  2248. sprintf("%-22s%s\n", "user-agent", Option["user-agent"] ? Option["user-agent"] :
  2249. "[NONE]")\
  2250. sprintf("%-22s%s\n", "theme", Option["theme"])\
  2251. sprintf("%-22s%s\n", "init file", InitScript ? InitScript : "[NONE]")\
  2252. sprintf("\n%-22s%s", "Report bugs to:", "https://github.com/soimort/translate-shell/issues")
  2253. }
  2254. function getHelp() {
  2255. return "Usage: " ansi("bold", Command)\
  2256. " [" ansi("underline", "OPTIONS") "]"\
  2257. " [" ansi("underline", "SOURCE") "]"\
  2258. ":[" ansi("underline", "TARGETS") "]"\
  2259. " [" ansi("underline", "TEXT") "]..." RS\
  2260. RS "Information options:" RS\
  2261. ins(1, ansi("bold", "-V") ", " ansi("bold", "-version")) RS\
  2262. ins(2, "Print version and exit.") RS\
  2263. ins(1, ansi("bold", "-H") ", " ansi("bold", "-help")) RS\
  2264. ins(2, "Print help message and exit.") RS\
  2265. ins(1, ansi("bold", "-M") ", " ansi("bold", "-man")) RS\
  2266. ins(2, "Show man page and exit.") RS\
  2267. ins(1, ansi("bold", "-T") ", " ansi("bold", "-reference")) RS\
  2268. ins(2, "Print reference table of languages and exit.") RS\
  2269. ins(1, ansi("bold", "-R") ", " ansi("bold", "-reference-english")) RS\
  2270. ins(2, "Print reference table of languages (in English names) and exit.") RS\
  2271. ins(1, ansi("bold", "-L ") ansi("underline", "CODES")\
  2272. ", " ansi("bold", "-list ") ansi("underline", "CODES")) RS\
  2273. ins(2, "Print details of languages and exit.") RS\
  2274. ins(1, ansi("bold", "-S") ", " ansi("bold", "-list-engines")) RS\
  2275. ins(2, "List available translation engines and exit.") RS\
  2276. ins(1, ansi("bold", "-U") ", " ansi("bold", "-upgrade")) RS\
  2277. ins(2, "Check for upgrade of this program.") RS\
  2278. RS "Translator options:" RS\
  2279. ins(1, ansi("bold", "-e ") ansi("underline", "ENGINE")\
  2280. ", " ansi("bold", "-engine ") ansi("underline", "ENGINE")) RS\
  2281. ins(2, "Specify the translation engine to use.") RS\
  2282. RS "Display options:" RS\
  2283. ins(1, ansi("bold", "-verbose")) RS\
  2284. ins(2, "Verbose mode. (default)") RS\
  2285. ins(1, ansi("bold", "-b") ", " ansi("bold", "-brief")) RS\
  2286. ins(2, "Brief mode.") RS\
  2287. ins(1, ansi("bold", "-d") ", " ansi("bold", "-dictionary")) RS\
  2288. ins(2, "Dictionary mode.") RS\
  2289. ins(1, ansi("bold", "-identify")) RS\
  2290. ins(2, "Language identification.") RS\
  2291. ins(1, ansi("bold", "-show-original ") ansi("underline", "Y/n")) RS\
  2292. ins(2, "Show original text or not.") RS\
  2293. ins(1, ansi("bold", "-show-original-phonetics ") ansi("underline", "Y/n")) RS\
  2294. ins(2, "Show phonetic notation of original text or not.") RS\
  2295. ins(1, ansi("bold", "-show-translation ") ansi("underline", "Y/n")) RS\
  2296. ins(2, "Show translation or not.") RS\
  2297. ins(1, ansi("bold", "-show-translation-phonetics ") ansi("underline", "Y/n")) RS\
  2298. ins(2, "Show phonetic notation of translation or not.") RS\
  2299. ins(1, ansi("bold", "-show-prompt-message ") ansi("underline", "Y/n")) RS\
  2300. ins(2, "Show prompt message or not.") RS\
  2301. ins(1, ansi("bold", "-show-languages ") ansi("underline", "Y/n")) RS\
  2302. ins(2, "Show source and target languages or not.") RS\
  2303. ins(1, ansi("bold", "-show-original-dictionary ") ansi("underline", "y/N")) RS\
  2304. ins(2, "Show dictionary entry of original text or not.") RS\
  2305. ins(1, ansi("bold", "-show-dictionary ") ansi("underline", "Y/n")) RS\
  2306. ins(2, "Show dictionary entry of translation or not.") RS\
  2307. ins(1, ansi("bold", "-show-alternatives ") ansi("underline", "Y/n")) RS\
  2308. ins(2, "Show alternative translations or not.") RS\
  2309. ins(1, ansi("bold", "-w ") ansi("underline", "NUM")\
  2310. ", " ansi("bold", "-width ") ansi("underline", "NUM")) RS\
  2311. ins(2, "Specify the screen width for padding.") RS\
  2312. ins(1, ansi("bold", "-indent ") ansi("underline", "NUM")) RS\
  2313. ins(2, "Specify the size of indent (number of spaces).") RS\
  2314. ins(1, ansi("bold", "-theme ") ansi("underline", "FILENAME")) RS\
  2315. ins(2, "Specify the theme to use.") RS\
  2316. ins(1, ansi("bold", "-no-theme")) RS\
  2317. ins(2, "Do not use any other theme than default.") RS\
  2318. ins(1, ansi("bold", "-no-ansi")) RS\
  2319. ins(2, "Do not use ANSI escape codes.") RS\
  2320. ins(1, ansi("bold", "-no-autocorrect")) RS\
  2321. ins(2, "Do not autocorrect. (if defaulted by the translation engine)") RS\
  2322. ins(1, ansi("bold", "-no-bidi")) RS\
  2323. ins(2, "Do not convert bidirectional texts.") RS\
  2324. ins(1, ansi("bold", "-no-warn")) RS\
  2325. ins(2, "Do not write warning messages to stderr.") RS\
  2326. ins(1, ansi("bold", "-dump")) RS\
  2327. ins(2, "Print raw API response instead.") RS\
  2328. RS "Audio options:" RS\
  2329. ins(1, ansi("bold", "-p, -play")) RS\
  2330. ins(2, "Listen to the translation.") RS\
  2331. ins(1, ansi("bold", "-speak")) RS\
  2332. ins(2, "Listen to the original text.") RS\
  2333. ins(1, ansi("bold", "-n ") ansi("underline", "VOICE")\
  2334. ", " ansi("bold", "-narrator ") ansi("underline", "VOICE")) RS\
  2335. ins(2, "Specify the narrator, and listen to the translation.") RS\
  2336. ins(1, ansi("bold", "-player ") ansi("underline", "PROGRAM")) RS\
  2337. ins(2, "Specify the audio player to use, and listen to the translation.") RS\
  2338. ins(1, ansi("bold", "-no-play")) RS\
  2339. ins(2, "Do not listen to the translation.") RS\
  2340. ins(1, ansi("bold", "-no-translate")) RS\
  2341. ins(2, "Do not translate anything when using -speak.") RS\
  2342. ins(1, ansi("bold", "-download-audio")) RS\
  2343. ins(2, "Download the audio to the current directory.") RS\
  2344. ins(1, ansi("bold", "-download-audio-as ") ansi("underline", "FILENAME")) RS\
  2345. ins(2, "Download the audio to the specified file.") RS\
  2346. RS "Terminal paging and browsing options:" RS\
  2347. ins(1, ansi("bold", "-v") ", " ansi("bold", "-view")) RS\
  2348. ins(2, "View the translation in a terminal pager.") RS\
  2349. ins(1, ansi("bold", "-pager ") ansi("underline", "PROGRAM")) RS\
  2350. ins(2, "Specify the terminal pager to use, and view the translation.") RS\
  2351. ins(1, ansi("bold", "-no-view")) RS\
  2352. ins(2, "Do not view the translation in a terminal pager.") RS\
  2353. ins(1, ansi("bold", "-browser ") ansi("underline", "PROGRAM")) RS\
  2354. ins(2, "Specify the web browser to use.") RS\
  2355. RS "Networking options:" RS\
  2356. ins(1, ansi("bold", "-x ") ansi("underline", "HOST:PORT")\
  2357. ", " ansi("bold", "-proxy ") ansi("underline", "HOST:PORT")) RS\
  2358. ins(2, "Use HTTP proxy on given port.") RS\
  2359. ins(1, ansi("bold", "-u ") ansi("underline", "STRING")\
  2360. ", " ansi("bold", "-user-agent ") ansi("underline", "STRING")) RS\
  2361. ins(2, "Specify the User-Agent to identify as.") RS\
  2362. RS "Interactive shell options:" RS\
  2363. ins(1, ansi("bold", "-I") ", " ansi("bold", "-interactive") ", " ansi("bold", "-shell")) RS\
  2364. ins(2, "Start an interactive shell.") RS\
  2365. ins(1, ansi("bold", "-E") ", " ansi("bold", "-emacs")) RS\
  2366. ins(2, "Start the GNU Emacs front-end for an interactive shell.") RS\
  2367. ins(1, ansi("bold", "-no-rlwrap")) RS\
  2368. ins(2, "Do not invoke rlwrap when starting an interactive shell.") RS\
  2369. RS "I/O options:" RS\
  2370. ins(1, ansi("bold", "-i ") ansi("underline", "FILENAME")\
  2371. ", " ansi("bold", "-input ") ansi("underline", "FILENAME")) RS\
  2372. ins(2, "Specify the input file.") RS\
  2373. ins(1, ansi("bold", "-o ") ansi("underline", "FILENAME")\
  2374. ", " ansi("bold", "-output ") ansi("underline", "FILENAME")) RS\
  2375. ins(2, "Specify the output file.") RS\
  2376. RS "Language preference options:" RS\
  2377. ins(1, ansi("bold", "-l ") ansi("underline", "CODE")\
  2378. ", " ansi("bold", "-hl ") ansi("underline", "CODE")\
  2379. ", " ansi("bold", "-lang ") ansi("underline", "CODE")) RS\
  2380. ins(2, "Specify your home language.") RS\
  2381. ins(1, ansi("bold", "-s ") ansi("underline", "CODE")\
  2382. ", " ansi("bold", "-sl ") ansi("underline", "CODE")\
  2383. ", " ansi("bold", "-source ") ansi("underline", "CODE")\
  2384. ", " ansi("bold", "-from ") ansi("underline", "CODE")) RS\
  2385. ins(2, "Specify the source language.") RS\
  2386. ins(1, ansi("bold", "-t ") ansi("underline", "CODES")\
  2387. ", " ansi("bold", "-tl ") ansi("underline", "CODE")\
  2388. ", " ansi("bold", "-target ") ansi("underline", "CODES")\
  2389. ", " ansi("bold", "-to ") ansi("underline", "CODES")) RS\
  2390. ins(2, "Specify the target language(s), joined by '+'.") RS\
  2391. RS "Other options:" RS\
  2392. ins(1, ansi("bold", "-no-init")) RS\
  2393. ins(2, "Do not load any initialization script.") RS\
  2394. RS "See the man page " Command "(1) for more information."
  2395. }
  2396. function showMan( temp) {
  2397. if (ENVIRON["TRANS_MANPAGE"]) {
  2398. initPager()
  2399. Groff = detectProgram("groff", "--version")
  2400. if (Pager && Groff) {
  2401. temp = "echo -E \"${TRANS_MANPAGE}\""
  2402. temp = temp PIPE\
  2403. Groff " -Wall -mtty-char -mandoc -Tutf8 "\
  2404. "-rLL=" Option["width"] "n -rLT=" Option["width"] "n"
  2405. switch (Pager) {
  2406. case "less":
  2407. temp = temp PIPE\
  2408. Pager " -s -P\"\\ \\Manual page " Command "(1) line %lt (press h for help or q to quit)\""
  2409. break
  2410. case "most":
  2411. temp = temp PIPE Pager " -Cs"
  2412. break
  2413. default:
  2414. temp = temp PIPE Pager
  2415. }
  2416. system(temp)
  2417. return
  2418. }
  2419. }
  2420. if (fileExists(ENVIRON["TRANS_DIR"] "/man/" Command ".1"))
  2421. system("man " parameterize(ENVIRON["TRANS_DIR"] "/man/" Command ".1") SUPERR)
  2422. else if (system("man " Command SUPERR))
  2423. print getHelp()
  2424. }
  2425. function getReference(displayName,
  2426. code, col, cols, i, j, name, num, r, rows, saveSortedIn,
  2427. t1, t2) {
  2428. num = 0
  2429. for (code in Locale)
  2430. if (Locale[code]["support"] != "unstable")
  2431. num++
  2432. rows = int(num / 3) + (num % 3 ? 1 : 0)
  2433. cols[0][0] = cols[1][0] = cols[2][0] = NULLSTR
  2434. i = 0
  2435. saveSortedIn = PROCINFO["sorted_in"]
  2436. PROCINFO["sorted_in"] = displayName == "endonym" ? "@ind_num_asc" :
  2437. "compName"
  2438. for (code in Locale) {
  2439. if (Locale[code]["support"] != "unstable") {
  2440. col = int(i / rows)
  2441. append(cols[col], code)
  2442. i++
  2443. }
  2444. }
  2445. PROCINFO["sorted_in"] = saveSortedIn
  2446. if (displayName == "endonym") {
  2447. r = "┌" replicate("─", 23) "┬" replicate("─", 23) "┬" replicate("─", 23) "┐" RS
  2448. for (i = 0; i < rows; i++) {
  2449. r = r "│"
  2450. for (j = 0; j < 3; j++) {
  2451. if (cols[j][i]) {
  2452. t1 = getDisplay(cols[j][i])
  2453. switch (cols[j][i]) {
  2454. case "he":
  2455. t1 = sprintf(" %-18s", t1)
  2456. break
  2457. case "ur":
  2458. t1 = sprintf(" %-17s", t1)
  2459. break
  2460. case "hi": case "gu": case "km": case "kn":
  2461. case "my": case "ne": case "pa": case "si":
  2462. case "ta": case "te": case "yi":
  2463. t1 = sprintf(" %-16s", t1)
  2464. break
  2465. case "yue":
  2466. t1 = sprintf(" %-13s", t1)
  2467. break
  2468. case "ja": case "ko":
  2469. t1 = sprintf(" %-12s", t1)
  2470. break
  2471. case "zh-CN": case "zh-TW":
  2472. t1 = sprintf(" %-11s", t1)
  2473. break
  2474. default:
  2475. if (length(t1) <= 15)
  2476. t1 = sprintf(" %-15s", t1)
  2477. }
  2478. switch (length(cols[j][i])) {
  2479. case 1: case 2: case 3: case 4:
  2480. t2 = sprintf("- %s │", ansi("bold", sprintf("%4s", cols[j][i])))
  2481. break
  2482. case 5:
  2483. t2 = sprintf("- %s│", ansi("bold", cols[j][i]))
  2484. break
  2485. case 6:
  2486. t2 = sprintf("-%s│", ansi("bold", cols[j][i]))
  2487. break
  2488. case 7:
  2489. t2 = sprintf("-%s", ansi("bold", cols[j][i]))
  2490. break
  2491. default:
  2492. t2 = ansi("bold", cols[j][i])
  2493. }
  2494. r = r t1 t2
  2495. } else
  2496. r = r sprintf("%23s│", NULLSTR)
  2497. }
  2498. r = r RS
  2499. }
  2500. r = r "└" replicate("─", 23) "┴" replicate("─", 23) "┴" replicate("─", 23) "┘"
  2501. } else {
  2502. r = "┌" replicate("─", 23) "┬" replicate("─", 23) "┬" replicate("─", 23) "┐" RS
  2503. for (i = 0; i < rows; i++) {
  2504. r = r "│"
  2505. for (j = 0; j < 3; j++) {
  2506. if (cols[j][i]) {
  2507. t1 = getName(cols[j][i])
  2508. if (length(t1) > 15)
  2509. t1 = substr(t1, 1, 12) "..."
  2510. t1 = sprintf(" %-15s", t1)
  2511. switch (length(cols[j][i])) {
  2512. case 1: case 2: case 3: case 4:
  2513. t2 = sprintf("- %s │", ansi("bold", sprintf("%4s", cols[j][i])))
  2514. break
  2515. case 5:
  2516. t2 = sprintf("- %s│", ansi("bold", cols[j][i]))
  2517. break
  2518. case 6:
  2519. t2 = sprintf("-%s│", ansi("bold", cols[j][i]))
  2520. break
  2521. case 7:
  2522. t2 = sprintf("-%s", ansi("bold", cols[j][i]))
  2523. break
  2524. default:
  2525. t2 = ansi("bold", cols[j][i])
  2526. }
  2527. r = r t1 t2
  2528. } else
  2529. r = r sprintf("%23s│", NULLSTR)
  2530. }
  2531. r = r RS
  2532. }
  2533. r = r "└" replicate("─", 23) "┴" replicate("─", 23) "┴" replicate("─", 23) "┘"
  2534. }
  2535. return r
  2536. }
  2537. function getList(codes, code, i, r, saveSortedIn) {
  2538. r = NULLSTR
  2539. if (!isarray(codes))
  2540. r = getDetails(codes)
  2541. else if (anything(codes)) {
  2542. saveSortedIn = PROCINFO["sorted_in"]
  2543. PROCINFO["sorted_in"] = "@ind_num_asc"
  2544. for (i in codes)
  2545. r = (r ? r RS prettify("target-seperator", replicate(Option["chr-target-seperator"], Option["width"])) RS\
  2546. : r) getDetails(codes[i])
  2547. PROCINFO["sorted_in"] = saveSortedIn
  2548. } else
  2549. r = getDetails(Option["hl"])
  2550. return r
  2551. }
  2552. function tokenize(returnTokens, string,
  2553. delimiters,
  2554. newlines,
  2555. quotes,
  2556. escapeChars,
  2557. leftBlockComments,
  2558. rightBlockComments,
  2559. lineComments,
  2560. reservedOperators,
  2561. reservedPatterns,
  2562. blockCommenting,
  2563. c,
  2564. currentToken,
  2565. escaping,
  2566. i,
  2567. lineCommenting,
  2568. p,
  2569. quoting,
  2570. r,
  2571. s,
  2572. tempGroup,
  2573. tempPattern,
  2574. tempString) {
  2575. if (!delimiters[0]) {
  2576. delimiters[0] = " "
  2577. delimiters[1] = "\t"
  2578. delimiters[2] = "\v"
  2579. }
  2580. if (!newlines[0]) {
  2581. newlines[0] = "\n"
  2582. newlines[1] = "\r"
  2583. }
  2584. if (!quotes[0]) {
  2585. quotes[0] = "\""
  2586. }
  2587. if (!escapeChars[0]) {
  2588. escapeChars[0] = "\\"
  2589. }
  2590. if (!leftBlockComments[0]) {
  2591. leftBlockComments[0] = "#|"
  2592. leftBlockComments[1] = "/*"
  2593. leftBlockComments[2] = "(*"
  2594. }
  2595. if (!rightBlockComments[0]) {
  2596. rightBlockComments[0] = "|#"
  2597. rightBlockComments[1] = "*/"
  2598. rightBlockComments[2] = "*)"
  2599. }
  2600. if (!lineComments[0]) {
  2601. lineComments[0] = ";"
  2602. lineComments[1] = "//"
  2603. lineComments[2] = "#"
  2604. }
  2605. if (!reservedOperators[0]) {
  2606. reservedOperators[0] = "("
  2607. reservedOperators[1] = ")"
  2608. reservedOperators[2] = "["
  2609. reservedOperators[3] = "]"
  2610. reservedOperators[4] = "{"
  2611. reservedOperators[5] = "}"
  2612. reservedOperators[6] = ","
  2613. }
  2614. if (!reservedPatterns[0]) {
  2615. reservedPatterns[0] = "[+-]?((0|[1-9][0-9]*)|[.][0-9]*|(0|[1-9][0-9]*)[.][0-9]*)([Ee][+-]?[0-9]+)?"
  2616. reservedPatterns[1] = "[+-]?0[0-7]+([.][0-7]*)?"
  2617. reservedPatterns[2] = "[+-]?0[Xx][0-9A-Fa-f]+([.][0-9A-Fa-f]*)?"
  2618. }
  2619. split(string, s, "")
  2620. currentToken = ""
  2621. quoting = escaping = blockCommenting = lineCommenting = 0
  2622. p = 0
  2623. i = 1
  2624. while (i <= length(s)) {
  2625. c = s[i]
  2626. r = substr(string, i)
  2627. if (blockCommenting) {
  2628. if (tempString = startsWithAny(r, rightBlockComments))
  2629. blockCommenting = 0
  2630. i++
  2631. } else if (lineCommenting) {
  2632. if (belongsTo(c, newlines))
  2633. lineCommenting = 0
  2634. i++
  2635. } else if (quoting) {
  2636. currentToken = currentToken c
  2637. if (escaping) {
  2638. escaping = 0
  2639. } else {
  2640. if (belongsTo(c, quotes)) {
  2641. if (currentToken) {
  2642. returnTokens[p++] = currentToken
  2643. currentToken = ""
  2644. }
  2645. quoting = 0
  2646. } else if (belongsTo(c, escapeChars)) {
  2647. escaping = 1
  2648. } else {
  2649. }
  2650. }
  2651. i++
  2652. } else {
  2653. if (belongsTo(c, delimiters) || belongsTo(c, newlines)) {
  2654. if (currentToken) {
  2655. returnTokens[p++] = currentToken
  2656. currentToken = ""
  2657. }
  2658. i++
  2659. } else if (belongsTo(c, quotes)) {
  2660. if (currentToken) {
  2661. returnTokens[p++] = currentToken
  2662. }
  2663. currentToken = c
  2664. quoting = 1
  2665. i++
  2666. } else if (tempString = startsWithAny(r, leftBlockComments)) {
  2667. if (currentToken) {
  2668. returnTokens[p++] = currentToken
  2669. currentToken = ""
  2670. }
  2671. blockCommenting = 1
  2672. i += length(tempString)
  2673. } else if (tempString = startsWithAny(r, lineComments)) {
  2674. if (currentToken) {
  2675. returnTokens[p++] = currentToken
  2676. currentToken = ""
  2677. }
  2678. lineCommenting = 1
  2679. i += length(tempString)
  2680. } else if (tempString = startsWithAny(r, reservedOperators)) {
  2681. if (currentToken) {
  2682. returnTokens[p++] = currentToken
  2683. currentToken = ""
  2684. }
  2685. returnTokens[p++] = tempString
  2686. i += length(tempString)
  2687. } else if (tempPattern = matchesAny(r, reservedPatterns)) {
  2688. if (currentToken) {
  2689. returnTokens[p++] = currentToken
  2690. currentToken = ""
  2691. }
  2692. match(r, "^" tempPattern, tempGroup)
  2693. returnTokens[p++] = tempGroup[0]
  2694. i += length(tempGroup[0])
  2695. } else {
  2696. currentToken = currentToken c
  2697. i++
  2698. }
  2699. }
  2700. }
  2701. if (currentToken)
  2702. returnTokens[p++] = currentToken
  2703. }
  2704. function parseJsonArray(returnAST, tokens,
  2705. leftBrackets,
  2706. rightBrackets,
  2707. separators,
  2708. i, j, key, p, stack, token) {
  2709. if (!leftBrackets[0]) {
  2710. leftBrackets[0] = "("
  2711. leftBrackets[1] = "["
  2712. leftBrackets[2] = "{"
  2713. }
  2714. if (!rightBrackets[0]) {
  2715. rightBrackets[0] = ")"
  2716. rightBrackets[1] = "]"
  2717. rightBrackets[2] = "}"
  2718. }
  2719. if (!separators[0]) {
  2720. separators[0] = ","
  2721. }
  2722. stack[p = 0] = 0
  2723. for (i = 0; i < length(tokens); i++) {
  2724. token = tokens[i]
  2725. if (belongsTo(token, leftBrackets))
  2726. stack[++p] = 0
  2727. else if (belongsTo(token, rightBrackets))
  2728. --p
  2729. else if (belongsTo(token, separators))
  2730. stack[p]++
  2731. else {
  2732. key = stack[0]
  2733. for (j = 1; j <= p; j++)
  2734. key = key SUBSEP stack[j]
  2735. returnAST[key] = token
  2736. }
  2737. }
  2738. }
  2739. function parseJson(returnAST, tokens,
  2740. arrayStartTokens, arrayEndTokens,
  2741. objectStartTokens, objectEndTokens,
  2742. commas, colons,
  2743. flag, i, j, key, name, p, stack, token) {
  2744. if (!arrayStartTokens[0]) arrayStartTokens[0] = "["
  2745. if (!arrayEndTokens[0]) arrayEndTokens[0] = "]"
  2746. if (!objectStartTokens[0]) objectStartTokens[0] = "{"
  2747. if (!objectEndTokens[0]) objectEndTokens[0] = "}"
  2748. if (!commas[0]) commas[0] = ","
  2749. if (!colons[0]) colons[0] = ":"
  2750. stack[p = 0] = 0
  2751. flag = 0
  2752. for (i = 0; i < length(tokens); i++) {
  2753. token = tokens[i]
  2754. if (belongsTo(token, arrayStartTokens)) {
  2755. stack[++p] = 0
  2756. } else if (belongsTo(token, objectStartTokens)) {
  2757. stack[++p] = NULLSTR
  2758. flag = 0
  2759. } else if (belongsTo(token, objectEndTokens) ||
  2760. belongsTo(token, arrayEndTokens)) {
  2761. --p
  2762. } else if (belongsTo(token, commas)) {
  2763. if (isnum(stack[p]))
  2764. stack[p]++
  2765. else
  2766. flag = 0
  2767. } else if (belongsTo(token, colons)) {
  2768. flag = 1
  2769. } else if (isnum(stack[p]) || flag) {
  2770. key = stack[0]
  2771. for (j = 1; j <= p; j++)
  2772. key = key SUBSEP stack[j]
  2773. returnAST[key] = token
  2774. flag = 0
  2775. } else {
  2776. stack[p] = unparameterize(token)
  2777. }
  2778. }
  2779. }
  2780. function parseList(returnAST, tokens,
  2781. leftBrackets,
  2782. rightBrackets,
  2783. separators,
  2784. i, j, key, p, stack, token) {
  2785. if (!leftBrackets[0]) {
  2786. leftBrackets[0] = "("
  2787. leftBrackets[1] = "["
  2788. leftBrackets[2] = "{"
  2789. }
  2790. if (!rightBrackets[0]) {
  2791. rightBrackets[0] = ")"
  2792. rightBrackets[1] = "]"
  2793. rightBrackets[2] = "}"
  2794. }
  2795. if (!separators[0]) {
  2796. separators[0] = ","
  2797. }
  2798. stack[p = 0] = 0
  2799. for (i = 0; i < length(tokens); i++) {
  2800. token = tokens[i]
  2801. if (belongsTo(token, leftBrackets)) {
  2802. stack[++p] = 0
  2803. } else if (belongsTo(token, rightBrackets)) {
  2804. stack[--p]++
  2805. } else if (belongsTo(token, separators)) {
  2806. } else {
  2807. key = NULLSTR
  2808. if (p > 0) {
  2809. for (j = 0; j < p - 1; j++)
  2810. key = key SUBSEP stack[j]
  2811. returnAST[key][stack[p - 1]] = NULLSTR
  2812. key = key SUBSEP stack[p - 1]
  2813. }
  2814. returnAST[key][stack[p]] = token
  2815. stack[p]++
  2816. }
  2817. }
  2818. }
  2819. function prettify(name, string, i, temp) {
  2820. temp = string
  2821. if ("sgr-" name in Option)
  2822. if (isarray(Option["sgr-" name]))
  2823. for (i in Option["sgr-" name])
  2824. temp = ansi(Option["sgr-" name][i], temp)
  2825. else
  2826. temp = ansi(Option["sgr-" name], temp)
  2827. return temp
  2828. }
  2829. function randomColor( i) {
  2830. i = int(5 * rand())
  2831. switch (i) {
  2832. case 0: return "green"
  2833. case 1: return "yellow"
  2834. case 2: return "blue"
  2835. case 3: return "magenta"
  2836. case 4: return "cyan"
  2837. default: return "default"
  2838. }
  2839. }
  2840. function setRandomTheme( i, n, temp) {
  2841. srand(systime())
  2842. for (i = 0; i < 3; i++) {
  2843. do temp = randomColor(); while (belongsTo(temp, n))
  2844. n[i] = temp
  2845. }
  2846. Option["sgr-prompt-message"] = Option["sgr-languages"] = n[0]
  2847. Option["sgr-original-dictionary-detailed-word-class"][1] = n[0]
  2848. Option["sgr-original-dictionary-detailed-word-class"][2] = "bold"
  2849. Option["sgr-original-dictionary-synonyms"] = n[0]
  2850. Option["sgr-original-dictionary-synonyms-word-class"][1] = n[0]
  2851. Option["sgr-original-dictionary-synonyms-word-class"][2] = "bold"
  2852. Option["sgr-original-dictionary-examples"] = n[0]
  2853. Option["sgr-original-dictionary-see-also"] = n[0]
  2854. Option["sgr-dictionary-word-class"][1] = n[0]
  2855. Option["sgr-dictionary-word-class"][2] = "bold"
  2856. Option["sgr-original"][1] = Option["sgr-original-phonetics"][1] = n[1]
  2857. Option["sgr-original"][2] = Option["sgr-original-phonetics"][2] = "bold"
  2858. Option["sgr-prompt-message-original"][1] = n[1]
  2859. Option["sgr-prompt-message-original"][2] = "bold"
  2860. Option["sgr-languages-sl"] = n[1]
  2861. Option["sgr-original-dictionary-detailed-explanation"][1] = n[1]
  2862. Option["sgr-original-dictionary-detailed-explanation"][2] = "bold"
  2863. Option["sgr-original-dictionary-detailed-example"] = n[1]
  2864. Option["sgr-original-dictionary-detailed-synonyms"] = n[1]
  2865. Option["sgr-original-dictionary-detailed-synonyms-item"][1] = n[1]
  2866. Option["sgr-original-dictionary-detailed-synonyms-item"][2] = "bold"
  2867. Option["sgr-original-dictionary-synonyms-synonyms"] = n[1]
  2868. Option["sgr-original-dictionary-synonyms-synonyms-item"][1] = n[1]
  2869. Option["sgr-original-dictionary-synonyms-synonyms-item"][2] = "bold"
  2870. Option["sgr-original-dictionary-examples-example"] = n[1]
  2871. Option["sgr-original-dictionary-examples-original"][1] = n[1]
  2872. Option["sgr-original-dictionary-examples-original"][2] = "bold"
  2873. Option["sgr-original-dictionary-examples-original"][3] = "underline"
  2874. Option["sgr-original-dictionary-see-also-phrases"] = n[1]
  2875. Option["sgr-original-dictionary-see-also-phrases-item"][1] = n[1]
  2876. Option["sgr-original-dictionary-see-also-phrases-item"][2] = "bold"
  2877. Option["sgr-dictionary-explanation"] = n[1]
  2878. Option["sgr-dictionary-explanation-item"][1] = n[1]
  2879. Option["sgr-dictionary-explanation-item"][2] = "bold"
  2880. Option["sgr-alternatives-original"][1] = n[1]
  2881. Option["sgr-alternatives-original"][2] = "bold"
  2882. Option["sgr-translation"][1] = Option["sgr-translation-phonetics"][1] = n[2]
  2883. Option["sgr-translation"][2] = Option["sgr-translation-phonetics"][2] = "bold"
  2884. Option["sgr-languages-tl"] = n[2]
  2885. Option["sgr-dictionary-word"][1] = n[2]
  2886. Option["sgr-dictionary-word"][2] = "bold"
  2887. Option["sgr-alternatives-translations"] = n[2]
  2888. Option["sgr-alternatives-translations-item"][1] = n[2]
  2889. Option["sgr-alternatives-translations-item"][2] = "bold"
  2890. Option["sgr-brief-translation"][1] = Option["sgr-brief-translation-phonetics"][1] = n[2]
  2891. Option["sgr-brief-translation"][2] = Option["sgr-brief-translation-phonetics"][2] = "bold"
  2892. Option["fmt-welcome-message"] = Name
  2893. Option["sgr-welcome-message"][1] = n[0]
  2894. Option["sgr-welcome-message"][2] = "bold"
  2895. Option["fmt-welcome-submessage"] = "(:q to quit)"
  2896. Option["sgr-welcome-submessage"] = n[0]
  2897. Option["fmt-prompt"] = "%s> "
  2898. Option["sgr-prompt"][1] = n[1]
  2899. Option["sgr-prompt"][2] = "bold"
  2900. }
  2901. function setDefaultTheme() {
  2902. Option["sgr-translation"] = Option["sgr-translation-phonetics"] = "bold"
  2903. Option["sgr-prompt-message-original"] = "underline"
  2904. Option["sgr-languages-sl"] = "underline"
  2905. Option["sgr-languages-tl"] = "bold"
  2906. Option["sgr-original-dictionary-detailed-explanation"] = "bold"
  2907. Option["sgr-original-dictionary-detailed-synonyms-item"] = "bold"
  2908. Option["sgr-original-dictionary-synonyms-synonyms-item"] = "bold"
  2909. Option["sgr-original-dictionary-examples-original"][1] = "bold"
  2910. Option["sgr-original-dictionary-examples-original"][2] = "underline"
  2911. Option["sgr-original-dictionary-see-also-phrases-item"] = "bold"
  2912. Option["sgr-dictionary-word"] = "bold"
  2913. Option["sgr-alternatives-original"] = "underline"
  2914. Option["sgr-alternatives-translations-item"] = "bold"
  2915. Option["fmt-welcome-message"] = Name
  2916. Option["sgr-welcome-message"] = "bold"
  2917. Option["fmt-welcome-submessage"] = "(:q to quit)"
  2918. Option["fmt-prompt"] = "%s> "
  2919. Option["sgr-prompt"] = "bold"
  2920. }
  2921. function setTheme( file, line, script) {
  2922. if (Option["theme"] && Option["theme"] != "default"\
  2923. && Option["theme"] != "none" && Option["theme"] != "random") {
  2924. file = Option["theme"]
  2925. if (!fileExists(file)) {
  2926. file = ENVIRON["HOME"] "/.translate-shell/" Option["theme"]
  2927. if (!fileExists(file)) {
  2928. file = ENVIRON["HOME"] "/.config/translate-shell/" Option["theme"]
  2929. if (!fileExists(file)) return
  2930. }
  2931. }
  2932. }
  2933. if (file && fileExists(file)) {
  2934. script = NULLSTR
  2935. while (getline line < file)
  2936. script = script "\n" line
  2937. loadOptions(script)
  2938. } else if (Option["theme"] == "none")
  2939. ;
  2940. else if (Option["theme"] == "random")
  2941. setRandomTheme()
  2942. else
  2943. setDefaultTheme()
  2944. }
  2945. function provides(engineName) {
  2946. Translator[tolower(engineName)] = TRUE
  2947. }
  2948. function engineMethod(methodName, engine, translator) {
  2949. if (!Translator[Option["engine"]]) {
  2950. engine = tolower(Option["engine"])
  2951. if (!Translator[engine])
  2952. for (translator in Translator)
  2953. if (Translator[translator] &&
  2954. translator ~ "^"engine) {
  2955. engine = translator
  2956. break
  2957. }
  2958. if (!Translator[engine]) {
  2959. e("[ERROR] Translator not found: " Option["engine"] "\n"\
  2960. " Run '-list-engines / -S' to see a list of available engines.")
  2961. exit 1
  2962. }
  2963. Option["engine"] = engine
  2964. }
  2965. return Option["engine"] methodName
  2966. }
  2967. function initAudioPlayer() {
  2968. AudioPlayer = !system("mpv" SUPOUT SUPERR) ?
  2969. "mpv --loop-file=no" :
  2970. (!system("mplayer" SUPOUT SUPERR) ?
  2971. "mplayer" :
  2972. (!system("mpg123 --version" SUPOUT SUPERR) ?
  2973. "mpg123" :
  2974. ""))
  2975. }
  2976. function initSpeechSynthesizer() {
  2977. SpeechSynthesizer = !system("say ''" SUPOUT SUPERR) ?
  2978. "say" :
  2979. (!system("espeak ''" SUPOUT SUPERR) ?
  2980. "espeak" :
  2981. "")
  2982. }
  2983. function initPager() {
  2984. Pager = !system("less -V" SUPOUT SUPERR) ?
  2985. "less" :
  2986. (!system("more -V" SUPOUT SUPERR) ?
  2987. "more" :
  2988. (!system("most" SUPOUT SUPERR) ?
  2989. "most" :
  2990. ""))
  2991. }
  2992. function initHttpService() {
  2993. _Init()
  2994. if (Option["proxy"]) {
  2995. match(Option["proxy"], /^(http:\/*)?(([^:]+):([^@]+)@)?([^\/]*):([^\/:]*)/, HttpProxySpec)
  2996. HttpAuthUser = HttpProxySpec[3]
  2997. HttpAuthPass = HttpProxySpec[4]
  2998. HttpAuthCredentials = base64(unquote(HttpAuthUser) ":" HttpAuthPass)
  2999. HttpService = "/inet/tcp/0/" HttpProxySpec[5] "/" HttpProxySpec[6]
  3000. HttpPathPrefix = HttpProtocol HttpHost
  3001. } else {
  3002. HttpService = "/inet/tcp/0/" HttpHost "/" HttpPort
  3003. HttpPathPrefix = ""
  3004. }
  3005. }
  3006. function preprocess(text) {
  3007. return quote(text)
  3008. }
  3009. function postprocess(text) {
  3010. text = gensub(/ ([.,;:?!"])/, "\\1", "g", text)
  3011. text = gensub(/(["]) /, "\\1", "g", text)
  3012. return text
  3013. }
  3014. function getResponse(text, sl, tl, hl,
  3015. content, header, isBody, url, group, status, location) {
  3016. url = _RequestUrl(text, sl, tl, hl)
  3017. header = "GET " url " HTTP/1.1\r\n"\
  3018. "Host: " HttpHost "\r\n"\
  3019. "Connection: close\r\n"
  3020. if (Option["user-agent"])
  3021. header = header "User-Agent: " Option["user-agent"] "\r\n"
  3022. if (Cookie)
  3023. header = header "Cookie: " Cookie "\r\n"
  3024. if (HttpAuthUser && HttpAuthPass)
  3025. header = header "Proxy-Authorization: Basic " HttpAuthCredentials "\r\n"
  3026. content = NULLSTR; isBody = 0
  3027. print header |& HttpService
  3028. while ((HttpService |& getline) > 0) {
  3029. if (isBody)
  3030. content = content ? content "\r\n" $0 : $0
  3031. else if (length($0) <= 1)
  3032. isBody = 1
  3033. else {
  3034. match($0, /^HTTP[^ ]* ([^ ]*)/, group)
  3035. if (RSTART) status = group[1]
  3036. match($0, /^Location: (.*)/, group)
  3037. if (RSTART) location = squeeze(group[1])
  3038. }
  3039. l(sprintf("%4s bytes > %s", length($0), $0))
  3040. }
  3041. close(HttpService)
  3042. if ((status == "301" || status == "302") && location)
  3043. content = curl(location)
  3044. return assert(content, "[ERROR] Null response.")
  3045. }
  3046. function postResponse(text, sl, tl, hl, type,
  3047. content, contentLength, contentType, group,
  3048. header, isBody, reqBody, url, status, location) {
  3049. url = _PostRequestUrl(text, sl, tl, hl, type)
  3050. contentType = _PostRequestContentType(text, sl, tl, hl, type)
  3051. reqBody = _PostRequestBody(text, sl, tl, hl, type)
  3052. if (DumpContentengths[reqBody])
  3053. contentLength = DumpContentengths[reqBody]
  3054. else
  3055. contentLength = DumpContentengths[reqBody] = dump(reqBody, group)
  3056. header = "POST " url " HTTP/1.1\r\n"\
  3057. "Host: " HttpHost "\r\n"\
  3058. "Connection: close\r\n"\
  3059. "Content-Length: " contentLength "\r\n"\
  3060. "Content-Type: " contentType "\r\n"
  3061. if (Option["user-agent"])
  3062. header = header "User-Agent: " Option["user-agent"] "\r\n"
  3063. if (Cookie)
  3064. header = header "Cookie: " Cookie "\r\n"
  3065. if (HttpAuthUser && HttpAuthPass)
  3066. header = header "Proxy-Authorization: Basic " HttpAuthCredentials "\r\n"
  3067. content = NULLSTR; isBody = 0
  3068. print (header "\r\n" reqBody) |& HttpService
  3069. while ((HttpService |& getline) > 0) {
  3070. if (isBody)
  3071. content = content ? content "\r\n" $0 : $0
  3072. else if (length($0) <= 1)
  3073. isBody = 1
  3074. else {
  3075. match($0, /^HTTP[^ ]* ([^ ]*)/, group)
  3076. if (RSTART) status = group[1]
  3077. match($0, /^Location: (.*)/, group)
  3078. if (RSTART) location = squeeze(group[1])
  3079. }
  3080. l(sprintf("%4s bytes > %s", length($0), $0))
  3081. }
  3082. close(HttpService)
  3083. if (status == "404") {
  3084. e("[ERROR] 404 Not Found")
  3085. exit 1
  3086. }
  3087. if ((status == "301" || status == "302") && location) {
  3088. url = "https" substr(url, 5)
  3089. content = curlPost(url, reqBody)
  3090. }
  3091. return content
  3092. }
  3093. function p(string) {
  3094. if (Option["view"])
  3095. print string | Option["pager"]
  3096. else
  3097. print string > Option["output"]
  3098. }
  3099. function play(text, tl, url) {
  3100. url = _TTSUrl(text, tl)
  3101. system(Option["player"] " " parameterize(url) SUPOUT SUPERR)
  3102. }
  3103. function download_audio(text, tl, url, output) {
  3104. url = _TTSUrl(text, tl)
  3105. if (Option["download-audio-as"])
  3106. output = Option["download-audio-as"]
  3107. else
  3108. output = text " [" Option["engine"] "] (" Option["narrator"] ").ts"
  3109. if (url ~ /^\//)
  3110. system("mv -- " parameterize(url) " " parameterize(output))
  3111. else
  3112. curl(url, output)
  3113. }
  3114. function getTranslation(text, sl, tl, hl,
  3115. isVerbose, toSpeech, returnPlaylist, returnIl) {
  3116. return _Translate(text, sl, tl, hl,
  3117. isVerbose, toSpeech, returnPlaylist, returnIl)
  3118. }
  3119. function fileTranslation(uri, group, temp1, temp2) {
  3120. temp1 = Option["input"]
  3121. temp2 = Option["verbose"]
  3122. match(uri, /^file:\/\/(.*)/, group)
  3123. Option["input"] = group[1]
  3124. Option["verbose"] = 0
  3125. translateMain()
  3126. Option["input"] = temp1
  3127. Option["verbose"] = temp2
  3128. }
  3129. function webTranslation(uri, sl, tl, hl) {
  3130. system(Option["browser"] " "\
  3131. parameterize(_WebTranslateUrl(uri, sl, tl, hl)) "&")
  3132. }
  3133. function translate(text, inline,
  3134. i, j, playlist, il, saveSortedIn) {
  3135. if (!getCode(Option["hl"])) {
  3136. w("[WARNING] Unknown language code: " Option["hl"] ", fallback to English: en")
  3137. Option["hl"] = "en"
  3138. } else if (isRTL(Option["hl"])) {
  3139. if (!FriBidi)
  3140. w("[WARNING] " getName(Option["hl"]) " is a right-to-left language, but FriBidi is not found.")
  3141. }
  3142. if (!getCode(Option["sl"])) {
  3143. w("[WARNING] Unknown source language code: " Option["sl"])
  3144. } else if (isRTL(Option["sl"])) {
  3145. if (!FriBidi)
  3146. w("[WARNING] " getName(Option["sl"]) " is a right-to-left language, but FriBidi is not found.")
  3147. }
  3148. saveSortedIn = PROCINFO["sorted_in"]
  3149. PROCINFO["sorted_in"] = "@ind_num_asc"
  3150. for (i in Option["tl"]) {
  3151. if (!Option["interactive"])
  3152. if (Option["verbose"] && i > 1)
  3153. p(prettify("target-seperator", replicate(Option["chr-target-seperator"], Option["width"])))
  3154. if (inline &&
  3155. startsWithAny(text, UriSchemes) == "file://") {
  3156. fileTranslation(text)
  3157. } else if (inline &&
  3158. startsWithAny(text, UriSchemes) == "http://" ||
  3159. startsWithAny(text, UriSchemes) == "https://") {
  3160. webTranslation(text, Option["sl"], Option["tl"][i], Option["hl"])
  3161. } else {
  3162. if (!Option["no-translate"])
  3163. p(getTranslation(text, Option["sl"], Option["tl"][i], Option["hl"], Option["verbose"], Option["play"] || Option["download-audio"], playlist, il))
  3164. else
  3165. il[0] = Option["sl"] == "auto" ? "en" : Option["sl"]
  3166. if (Option["play"] == 1) {
  3167. if (Option["player"])
  3168. for (j in playlist)
  3169. play(playlist[j]["text"], playlist[j]["tl"])
  3170. else if (SpeechSynthesizer)
  3171. for (j in playlist)
  3172. print playlist[j]["text"] | SpeechSynthesizer
  3173. } else if (Option["play"] == 2) {
  3174. if (Option["player"])
  3175. play(text, il[0])
  3176. else if (SpeechSynthesizer)
  3177. print text | SpeechSynthesizer
  3178. }
  3179. if (Option["download-audio"] == 1) {
  3180. if (Option["play"] != 2 && !Option["no-translate"])
  3181. download_audio(playlist[length(playlist) - 1]["text"],\
  3182. playlist[length(playlist) - 1]["tl"])
  3183. else
  3184. download_audio(text, il[0])
  3185. }
  3186. }
  3187. }
  3188. PROCINFO["sorted_in"] = saveSortedIn
  3189. }
  3190. function translateMain( i, line) {
  3191. if (Option["interactive"])
  3192. prompt()
  3193. if (Option["input"] == STDIN || fileExists(Option["input"])) {
  3194. i = 0
  3195. while (getline line < Option["input"])
  3196. if (line) {
  3197. if (!Option["interactive"])
  3198. if (Option["verbose"] && i++ > 0)
  3199. p(prettify("source-seperator",
  3200. replicate(Option["chr-source-seperator"],
  3201. Option["width"])))
  3202. if (Option["interactive"])
  3203. repl(line)
  3204. else
  3205. translate(line)
  3206. } else {
  3207. if (!Option["interactive"])
  3208. if (!Option["verbose"])
  3209. p(line)
  3210. }
  3211. } else
  3212. e("[ERROR] File not found: " Option["input"])
  3213. }
  3214. function _Init( vm) {
  3215. vm = engineMethod("Init")
  3216. return @vm()
  3217. }
  3218. function _RequestUrl(text, sl, tl, hl, vm) {
  3219. vm = engineMethod("RequestUrl")
  3220. return @vm(text, sl, tl, hl)
  3221. }
  3222. function _PostRequestUrl(text, sl, tl, hl, type, vm) {
  3223. vm = engineMethod("PostRequestUrl")
  3224. return @vm(text, sl, tl, hl, type)
  3225. }
  3226. function _PostRequestContentType(text, sl, tl, hl, type, vm) {
  3227. vm = engineMethod("PostRequestContentType")
  3228. return @vm(text, sl, tl, hl, type)
  3229. }
  3230. function _PostRequestBody(text, sl, tl, hl, type, vm) {
  3231. vm = engineMethod("PostRequestBody")
  3232. return @vm(text, sl, tl, hl, type)
  3233. }
  3234. function _TTSUrl(text, tl, vm) {
  3235. vm = engineMethod("TTSUrl")
  3236. return @vm(text, tl)
  3237. }
  3238. function _WebTranslateUrl(uri, sl, tl, hl, vm) {
  3239. vm = engineMethod("WebTranslateUrl")
  3240. return @vm(uri, sl, tl, hl)
  3241. }
  3242. function _Translate(text, sl, tl, hl,
  3243. isVerbose, toSpeech, returnPlaylist, returnIl,
  3244. vm) {
  3245. vm = engineMethod("Translate")
  3246. return @vm(text, sl, tl, hl,
  3247. isVerbose, toSpeech, returnPlaylist, returnIl)
  3248. }
  3249. BEGIN { provides("google") }
  3250. function genRL(a, x,
  3251. b, c, d, i, y) {
  3252. tokenize(y, x)
  3253. parseList(b, y)
  3254. i = SUBSEP 0
  3255. for (c = 0; c < length(b[i]) - 2; c += 3) {
  3256. d = b[i][c + 2]
  3257. d = d >= 97 ? d - 87 :
  3258. d - 48
  3259. d = b[i][c + 1] == 43 ? rshift(a, d) : lshift(a, d)
  3260. a = b[i][c] == 43 ? and(a + d, 4294967295) : xor(a, d)
  3261. }
  3262. return a
  3263. }
  3264. function genTK(text,
  3265. a, d, dLen, e, tkk, ub, vb) {
  3266. if (TK[text]) return TK[text]
  3267. tkk = systime() / 3600
  3268. ub = "[43,45,51,94,43,98,43,45,102]"
  3269. vb = "[43,45,97,94,43,54]"
  3270. dLen = dump(text, d)
  3271. a = tkk
  3272. for (e = 1; e <= dLen; e++)
  3273. a = genRL(a + d[e], vb)
  3274. a = genRL(a, ub)
  3275. 0 > a && (a = and(a, 2147483647) + 2147483648)
  3276. a %= 1e6
  3277. TK[text] = a "." xor(a, tkk)
  3278. l(text, "text")
  3279. l(tkk, "tkk")
  3280. l(TK[text], "tk")
  3281. return TK[text]
  3282. }
  3283. function googleInit() {
  3284. HttpProtocol = "http://"
  3285. HttpHost = "translate.googleapis.com"
  3286. HttpPort = 80
  3287. }
  3288. function googleRequestUrl(text, sl, tl, hl, qc) {
  3289. qc = Option["no-autocorrect"] ? "qc" : "qca";
  3290. return HttpPathPrefix "/translate_a/single?client=gtx"\
  3291. "&ie=UTF-8&oe=UTF-8"\
  3292. "&dt=bd&dt=ex&dt=ld&dt=md&dt=rw&dt=rm&dt=ss&dt=t&dt=at"\
  3293. "&dt=" qc "&sl=" sl "&tl=" tl "&hl=" hl\
  3294. "&q=" preprocess(text)
  3295. }
  3296. function googleTTSUrl(text, tl) {
  3297. return HttpProtocol HttpHost "/translate_tts?ie=UTF-8&client=gtx"\
  3298. "&tl=" tl "&q=" preprocess(text)
  3299. }
  3300. function googleWebTranslateUrl(uri, sl, tl, hl) {
  3301. return "https://translate.google.com/translate?"\
  3302. "hl=" hl "&sl=" sl "&tl=" tl "&u=" uri
  3303. }
  3304. function googleTranslate(text, sl, tl, hl,
  3305. isVerbose, toSpeech, returnPlaylist, returnIl,
  3306. r,
  3307. content, tokens, ast,
  3308. _sl, _tl, _hl, il, ils, isPhonetic,
  3309. article, example, explanation, ref, word,
  3310. translation, translations, phonetics,
  3311. wordClasses, words, segments, altTranslations,
  3312. original, oPhonetics, oWordClasses, oWords,
  3313. oRefs, oSynonymClasses, oSynonyms,
  3314. oExamples, oSeeAlso,
  3315. wShowOriginal, wShowOriginalPhonetics,
  3316. wShowTranslation, wShowTranslationPhonetics,
  3317. wShowPromptMessage, wShowLanguages,
  3318. wShowOriginalDictionary, wShowDictionary,
  3319. wShowAlternatives,
  3320. hasWordClasses, hasAltTranslations,
  3321. i, j, k, group, temp, saveSortedIn) {
  3322. isPhonetic = match(tl, /^@/)
  3323. tl = substr(tl, 1 + isPhonetic)
  3324. if (!getCode(tl)) {
  3325. w("[WARNING] Unknown target language code: " tl)
  3326. } else if (isRTL(tl)) {
  3327. if (!FriBidi)
  3328. w("[WARNING] " getName(tl) " is a right-to-left language, but FriBidi is not found.")
  3329. }
  3330. _sl = getCode(sl); if (!_sl) _sl = sl
  3331. _tl = getCode(tl); if (!_tl) _tl = tl
  3332. _hl = getCode(hl); if (!_hl) _hl = hl
  3333. content = getResponse(text, _sl, _tl, _hl)
  3334. if (Option["dump"])
  3335. return content
  3336. tokenize(tokens, content)
  3337. parseJsonArray(ast, tokens)
  3338. l(content, "content", 1, 1)
  3339. l(tokens, "tokens", 1, 0, 1)
  3340. l(ast, "ast")
  3341. if (!isarray(ast) || !anything(ast)) {
  3342. e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
  3343. ExitCode = 1
  3344. return
  3345. }
  3346. saveSortedIn = PROCINFO["sorted_in"]
  3347. PROCINFO["sorted_in"] = "compareByIndexFields"
  3348. for (i in ast) {
  3349. if (ast[i] == "null") continue
  3350. if (i ~ "^0" SUBSEP "0" SUBSEP "[[:digit:]]+" SUBSEP "0$")
  3351. append(translations, literal(ast[i]))
  3352. if (i ~ "^0" SUBSEP "0" SUBSEP "[[:digit:]]+" SUBSEP "1$")
  3353. append(original, literal(ast[i]))
  3354. if (i ~ "^0" SUBSEP "0" SUBSEP "[[:digit:]]+" SUBSEP "2$")
  3355. append(phonetics, literal(ast[i]))
  3356. if (i ~ "^0" SUBSEP "0" SUBSEP "[[:digit:]]+" SUBSEP "3$")
  3357. append(oPhonetics, literal(ast[i]))
  3358. if (match(i, "^0" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
  3359. wordClasses[group[1]] = literal(ast[i])
  3360. if (match(i, "^0" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "2" SUBSEP "([[:digit:]]+)" SUBSEP "([[:digit:]]+)$", group))
  3361. words[group[1]][group[2]][group[3]] = literal(ast[i])
  3362. if (match(i, "^0" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "2" SUBSEP "([[:digit:]]+)" SUBSEP "1" SUBSEP "([[:digit:]]+)$", group))
  3363. words[group[1]][group[2]]["1"][group[3]] = literal(ast[i])
  3364. if (match(i, "^0" SUBSEP "5" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group)) {
  3365. segments[group[1]] = literal(ast[i])
  3366. altTranslations[group[1]][0] = ""
  3367. }
  3368. if (match(i, "^0" SUBSEP "5" SUBSEP "([[:digit:]]+)" SUBSEP "2" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
  3369. altTranslations[group[1]][group[2]] = literal(ast[i])
  3370. if (i ~ "^0" SUBSEP "7" SUBSEP "5$") {
  3371. if (ast[i] == "true")
  3372. w("Showing translation for: (use -no-auto to disable autocorrect)")
  3373. else
  3374. w("Did you mean: "\
  3375. ansi("bold", unparameterize(ast["0" SUBSEP "7" SUBSEP "1"])))
  3376. }
  3377. if (i ~ "^0" SUBSEP "8" SUBSEP "0" SUBSEP "[[:digit:]]+$" ||
  3378. i ~ "^0" SUBSEP "2$")
  3379. append(ils, literal(ast[i]))
  3380. if (match(i, "^0" SUBSEP "11" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
  3381. oSynonymClasses[group[1]] = literal(ast[i])
  3382. if (match(i, "^0" SUBSEP "11" SUBSEP "([[:digit:]]+)" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "1$", group))
  3383. if (ast[i]) {
  3384. oRefs[literal(ast[i])][1] = group[1]
  3385. oRefs[literal(ast[i])][2] = group[2]
  3386. }
  3387. if (match(i, "^0" SUBSEP "11" SUBSEP "([[:digit:]]+)" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "0" SUBSEP "([[:digit:]]+)$", group))
  3388. oSynonyms[group[1]][group[2]][group[3]] = literal(ast[i])
  3389. if (match(i, "^0" SUBSEP "12" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
  3390. oWordClasses[group[1]] = literal(ast[i])
  3391. if (match(i, "^0" SUBSEP "12" SUBSEP "([[:digit:]]+)" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
  3392. oWords[group[1]][group[2]][0] = literal(ast[i])
  3393. if (match(i, "^0" SUBSEP "12" SUBSEP "([[:digit:]]+)" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "1$", group))
  3394. oWords[group[1]][group[2]][1] = literal(ast[i])
  3395. if (match(i, "^0" SUBSEP "12" SUBSEP "([[:digit:]]+)" SUBSEP "1" SUBSEP "([[:digit:]]+)" SUBSEP "2$", group))
  3396. oWords[group[1]][group[2]][2] = literal(ast[i])
  3397. if (match(i, "^0" SUBSEP "13" SUBSEP "0" SUBSEP "([[:digit:]]+)" SUBSEP "0$", group))
  3398. oExamples[group[1]] = literal(ast[i])
  3399. if (match(i, "^0" SUBSEP "14" SUBSEP "0" SUBSEP "([[:digit:]]+)$", group))
  3400. oSeeAlso[group[1]] = literal(ast[i])
  3401. }
  3402. PROCINFO["sorted_in"] = saveSortedIn
  3403. translation = join(translations)
  3404. returnIl[0] = il = !anything(ils) || belongsTo(sl, ils) ? sl : ils[0]
  3405. if (Option["verbose"] < -1)
  3406. return il
  3407. else if (Option["verbose"] < 0)
  3408. return getList(il)
  3409. if (!isVerbose) {
  3410. r = isPhonetic && anything(phonetics) ?
  3411. prettify("brief-translation-phonetics", join(phonetics, " ")) :
  3412. prettify("brief-translation", s(translation, tl))
  3413. if (toSpeech) {
  3414. returnPlaylist[0]["text"] = translation
  3415. returnPlaylist[0]["tl"] = tl
  3416. }
  3417. } else {
  3418. wShowOriginal = Option["show-original"]
  3419. wShowOriginalPhonetics = Option["show-original-phonetics"]
  3420. wShowTranslation = Option["show-translation"]
  3421. wShowTranslationPhonetics = Option["show-translation-phonetics"]
  3422. wShowPromptMessage = Option["show-prompt-message"]
  3423. wShowLanguages = Option["show-languages"]
  3424. wShowOriginalDictionary = Option["show-original-dictionary"]
  3425. wShowDictionary = Option["show-dictionary"]
  3426. wShowAlternatives = Option["show-alternatives"]
  3427. if (!anything(oPhonetics)) wShowOriginalPhonetics = 0
  3428. if (!anything(phonetics)) wShowTranslationPhonetics = 0
  3429. if (getCode(il) == getCode(tl) &&\
  3430. (isarray(oWordClasses) || isarray(oSynonymClasses) ||\
  3431. isarray(oExamples) || isarray(oSeeAlso))) {
  3432. wShowOriginalDictionary = 1
  3433. wShowTranslation = 0
  3434. }
  3435. hasWordClasses = exists(wordClasses)
  3436. hasAltTranslations = exists(altTranslations[0])
  3437. if (!hasWordClasses && !hasAltTranslations)
  3438. wShowPromptMessage = wShowLanguages = 0
  3439. if (!hasWordClasses) wShowDictionary = 0
  3440. if (!hasAltTranslations) wShowAlternatives = 0
  3441. if (wShowOriginal) {
  3442. if (r) r = r RS RS
  3443. r = r m("-- display original text & phonetics")
  3444. r = r prettify("original", s(join(original, " "), il))
  3445. if (wShowOriginalPhonetics)
  3446. r = r RS prettify("original-phonetics", showPhonetics(join(oPhonetics, " "), il))
  3447. }
  3448. if (wShowTranslation) {
  3449. if (r) r = r RS RS
  3450. r = r m("-- display major translation & phonetics")
  3451. r = r prettify("translation", s(translation, tl))
  3452. if (wShowTranslationPhonetics)
  3453. r = r RS prettify("translation-phonetics", showPhonetics(join(phonetics, " "), tl))
  3454. }
  3455. if (wShowPromptMessage || wShowLanguages)
  3456. if (r) r = r RS
  3457. if (wShowPromptMessage) {
  3458. if (hasWordClasses) {
  3459. if (r) r = r RS
  3460. r = r m("-- display prompt message (Definitions of ...)")
  3461. if (isRTL(hl))
  3462. r = r prettify("prompt-message", s(showDefinitionsOf(hl, join(original, " "))))
  3463. else {
  3464. split(showDefinitionsOf(hl, "\0%s\0"), group, "\0")
  3465. for (i = 1; i <= length(group); i++) {
  3466. if (group[i] == "%s")
  3467. r = r prettify("prompt-message-original", show(join(original, " "), il))
  3468. else
  3469. r = r prettify("prompt-message", group[i])
  3470. }
  3471. }
  3472. } else if (hasAltTranslations) {
  3473. if (r) r = r RS
  3474. r = r m("-- display prompt message (Translations of ...)")
  3475. if (isRTL(hl))
  3476. r = r prettify("prompt-message", s(showTranslationsOf(hl, join(original, " "))))
  3477. else {
  3478. split(showTranslationsOf(hl, "\0%s\0"), group, "\0")
  3479. for (i = 1; i <= length(group); i++) {
  3480. if (group[i] == "%s")
  3481. r = r prettify("prompt-message-original", show(join(original, " "), il))
  3482. else
  3483. r = r prettify("prompt-message", group[i])
  3484. }
  3485. }
  3486. }
  3487. }
  3488. if (wShowLanguages) {
  3489. if (r) r = r RS
  3490. r = r m("-- display source language -> target language")
  3491. temp = Option["fmt-languages"]
  3492. if (!temp) temp = "[ %s -> %t ]"
  3493. split(temp, group, /(%s|%S|%t|%T)/)
  3494. r = r prettify("languages", group[1])
  3495. if (temp ~ /%s/)
  3496. r = r prettify("languages-sl", getDisplay(il))
  3497. if (temp ~ /%S/)
  3498. r = r prettify("languages-sl", getName(il))
  3499. r = r prettify("languages", group[2])
  3500. if (temp ~ /%t/)
  3501. r = r prettify("languages-tl", getDisplay(tl))
  3502. if (temp ~ /%T/)
  3503. r = r prettify("languages-tl", getName(tl))
  3504. r = r prettify("languages", group[3])
  3505. }
  3506. if (wShowOriginalDictionary) {
  3507. if (exists(oWordClasses)) {
  3508. if (r) r = r RS
  3509. r = r m("-- display original dictionary (detailed explanations)")
  3510. for (i = 0; i < length(oWordClasses); i++) {
  3511. r = (i > 0 ? r RS : r) RS prettify("original-dictionary-detailed-word-class", s(oWordClasses[i], hl))
  3512. for (j = 0; j < length(oWords[i]); j++) {
  3513. explanation = oWords[i][j][0]
  3514. ref = oWords[i][j][1]
  3515. example = oWords[i][j][2]
  3516. r = (j > 0 ? r RS : r) RS prettify("original-dictionary-detailed-explanation", ins(1, explanation, il))
  3517. if (example)
  3518. r = r RS prettify("original-dictionary-detailed-example", ins(2, "- \"" example "\"", il))
  3519. if (ref && isarray(oRefs[ref])) {
  3520. temp = prettify("original-dictionary-detailed-synonyms", ins(1, show(showSynonyms(hl), hl) ": "))
  3521. temp = temp prettify("original-dictionary-detailed-synonyms-item", show(oSynonyms[oRefs[ref][1]][oRefs[ref][2]][0], il))
  3522. for (k = 1; k < length(oSynonyms[oRefs[ref][1]][oRefs[ref][2]]); k++)
  3523. temp = temp prettify("original-dictionary-detailed-synonyms", ", ")\
  3524. prettify("original-dictionary-detailed-synonyms-item", show(oSynonyms[oRefs[ref][1]][oRefs[ref][2]][k], il))
  3525. r = r RS temp
  3526. }
  3527. }
  3528. }
  3529. }
  3530. if (exists(oSynonymClasses)) {
  3531. r = r RS RS
  3532. r = r m("-- display original dictionary (synonyms)")
  3533. r = r prettify("original-dictionary-synonyms", s(showSynonyms(hl), hl))
  3534. for (i = 0; i < length(oSynonymClasses); i++) {
  3535. r = (i > 0 ? r RS : r) RS prettify("original-dictionary-synonyms-word-class", ins(1, oSynonymClasses[i], hl))
  3536. for (j = 0; j < length(oSynonyms[i]); j++) {
  3537. temp = prettify("original-dictionary-synonyms-synonyms", ins(2, "- "))
  3538. temp = temp prettify("original-dictionary-synonyms-synonyms-item", show(oSynonyms[i][j][0], il))
  3539. for (k = 1; k < length(oSynonyms[i][j]); k++)
  3540. temp = temp prettify("original-dictionary-synonyms-synonyms", ", ")\
  3541. prettify("original-dictionary-synonyms-synonyms-item", show(oSynonyms[i][j][k], il))
  3542. r = r RS temp
  3543. }
  3544. }
  3545. }
  3546. if (exists(oExamples)) {
  3547. r = r RS RS
  3548. r = r m("-- display original dictionary (examples)")
  3549. r = r prettify("original-dictionary-examples", s(showExamples(hl), hl))
  3550. for (i = 0; i < length(oExamples); i++) {
  3551. example = oExamples[i]
  3552. temp = prettify("original-dictionary-examples-example", ins(1, "- "))
  3553. split(example, group, /(<b>|<\/b>)/)
  3554. if (group[3] ~ / [[:punct:].]/)
  3555. group[3] = substr(group[3], 2)
  3556. if (isRTL(il))
  3557. temp = temp show(group[1] group[2] group[3], il)
  3558. else
  3559. temp = temp prettify("original-dictionary-examples-example", group[1])\
  3560. prettify("original-dictionary-examples-original", group[2])\
  3561. prettify("original-dictionary-examples-example", group[3])
  3562. r = (i > 0 ? r RS : r) RS temp
  3563. }
  3564. }
  3565. if (exists(oSeeAlso)) {
  3566. r = r RS RS
  3567. r = r m("-- display original dictionary (see also)")
  3568. r = r prettify("original-dictionary-see-also", s(showSeeAlso(hl), hl))
  3569. temp = ins(1, prettify("original-dictionary-see-also-phrases-item", show(oSeeAlso[0], il)))
  3570. for (k = 1; k < length(oSeeAlso); k++)
  3571. temp = temp prettify("original-dictionary-see-also-phrases", ", ")\
  3572. prettify("original-dictionary-see-also-phrases-item", show(oSeeAlso[k], il))
  3573. r = r RS temp
  3574. }
  3575. }
  3576. if (wShowDictionary) {
  3577. if (r) r = r RS
  3578. r = r m("-- display dictionary entries")
  3579. for (i = 0; i < length(wordClasses); i++) {
  3580. r = (i > 0 ? r RS : r) RS prettify("dictionary-word-class", s(wordClasses[i], hl))
  3581. for (j = 0; j < length(words[i]); j++) {
  3582. word = words[i][j][0]
  3583. article = words[i][j][4]
  3584. if (isRTL(il))
  3585. explanation = join(words[i][j][1], ", ")
  3586. else {
  3587. explanation = prettify("dictionary-explanation-item", words[i][j][1][0])
  3588. for (k = 1; k < length(words[i][j][1]); k++)
  3589. explanation = explanation prettify("dictionary-explanation", ", ")\
  3590. prettify("dictionary-explanation-item", words[i][j][1][k])
  3591. }
  3592. r = r RS prettify("dictionary-word", ins(1, (article ? "(" article ") " : "") word, tl))
  3593. if (isRTL(il))
  3594. r = r RS prettify("dictionary-explanation-item", ins(2, explanation, il))
  3595. else
  3596. r = r RS ins(2, explanation)
  3597. }
  3598. }
  3599. }
  3600. if (wShowAlternatives) {
  3601. if (r) r = r RS RS
  3602. r = r m("-- display alternative translations")
  3603. for (i = 0; i < length(altTranslations); i++) {
  3604. r = (i > 0 ? r RS : r) prettify("alternatives-original", show(segments[i], il))
  3605. if (isRTL(tl)) {
  3606. temp = join(altTranslations[i], ", ")
  3607. r = r RS prettify("alternatives-translations-item", ins(1, temp, tl))
  3608. } else {
  3609. temp = prettify("alternatives-translations-item", altTranslations[i][0])
  3610. for (j = 1; j < length(altTranslations[i]); j++)
  3611. temp = temp prettify("alternatives-translations", ", ")\
  3612. prettify("alternatives-translations-item", altTranslations[i][j])
  3613. r = r RS ins(1, temp)
  3614. }
  3615. }
  3616. }
  3617. if (toSpeech) {
  3618. if (index(showTranslationsOf(hl, "%s"), "%s") > 2) {
  3619. returnPlaylist[0]["text"] = showTranslationsOf(hl)
  3620. returnPlaylist[0]["tl"] = hl
  3621. returnPlaylist[1]["text"] = join(original)
  3622. returnPlaylist[1]["tl"] = il
  3623. } else {
  3624. returnPlaylist[0]["text"] = join(original)
  3625. returnPlaylist[0]["tl"] = il
  3626. returnPlaylist[1]["text"] = showTranslationsOf(hl)
  3627. returnPlaylist[1]["tl"] = hl
  3628. }
  3629. returnPlaylist[2]["text"] = translation
  3630. returnPlaylist[2]["tl"] = tl
  3631. }
  3632. }
  3633. return r
  3634. }
  3635. BEGIN { provides("bing") }
  3636. function bingInit() {
  3637. HttpProtocol = "http://"
  3638. HttpHost = "www.bing.com"
  3639. HttpPort = 80
  3640. }
  3641. function bingSetIG( content, cookie, group, header, isBody,
  3642. url, status, location) {
  3643. url = HttpPathPrefix "/translator"
  3644. header = "GET " url " HTTP/1.1\r\n"\
  3645. "Host: " HttpHost "\r\n"\
  3646. "Connection: close\r\n"
  3647. if (Option["user-agent"])
  3648. header = header "User-Agent: " Option["user-agent"] "\r\n"
  3649. cookie = NULLSTR
  3650. print header |& HttpService
  3651. while ((HttpService |& getline) > 0) {
  3652. match($0, /Set-Cookie: ([^;]*);/, group)
  3653. if (group[1]) {
  3654. cookie = cookie (cookie ? "; " : NULLSTR) group[1]
  3655. }
  3656. if (isBody)
  3657. content = content ? content "\r\n" $0 : $0
  3658. else if (length($0) <= 1)
  3659. isBody = 1
  3660. else {
  3661. match($0, /^HTTP[^ ]* ([^ ]*)/, group)
  3662. if (RSTART) status = group[1]
  3663. match($0, /^Location: (.*)/, group)
  3664. if (RSTART) location = squeeze(group[1])
  3665. }
  3666. l(sprintf("%4s bytes > %s", length($0), length($0) < 1024 ? $0 : "..."))
  3667. }
  3668. close(HttpService)
  3669. if ((status == "301" || status == "302") && location)
  3670. content = curl(location)
  3671. Cookie = cookie
  3672. match(content, /IG:"([^"]+)"/, group)
  3673. if (group[1]) {
  3674. IG = group[1]
  3675. } else {
  3676. e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
  3677. exit 1
  3678. }
  3679. }
  3680. function bingTTSUrl(text, tl,
  3681. country, gender, i, group,
  3682. header, content, isBody) {
  3683. gender = "female"
  3684. country = NULLSTR
  3685. split(Option["narrator"], group, ",")
  3686. for (i in group) {
  3687. if (group[i] ~ /^(f(emale)?|w(oman)?)$/)
  3688. gender = "female"
  3689. else if (group[i] ~ /^m(ale|an)?$/)
  3690. gender = "male"
  3691. else
  3692. country = group[i]
  3693. }
  3694. if (country) tl = tl "-" country
  3695. else if (tl == "ar") tl = tl "-EG"
  3696. else if (tl == "da") tl = tl "-DK"
  3697. else if (tl == "de") tl = tl "-DE"
  3698. else if (tl == "en") tl = tl "-US"
  3699. else if (tl == "es") tl = tl "-ES"
  3700. else if (tl == "fi") tl = tl "-FI"
  3701. else if (tl == "fr") tl = tl "-FR"
  3702. else if (tl == "it") tl = tl "-IT"
  3703. else if (tl == "ja") tl = tl "-JP"
  3704. else if (tl == "ko") tl = tl "-KR"
  3705. else if (tl == "nl") tl = tl "-NL"
  3706. else if (tl == "nb") tl = tl "-NO"
  3707. else if (tl == "pl") tl = tl "-PL"
  3708. else if (tl == "pt") tl = tl "-PT"
  3709. else if (tl == "ru") tl = tl "-RU"
  3710. else if (tl == "sv") tl = tl "-SE"
  3711. else if (tl == "yue") ;
  3712. else if (tl == "zh") tl = tl "-CN"
  3713. header = "GET " "/translator/api/language/Speak?"\
  3714. "locale=" tl "&text=" preprocess(text)\
  3715. "&gender=" gender "&media=audio/mp3" " HTTP/1.1\r\n"\
  3716. "Host: " HttpHost "\r\n"\
  3717. "Connection: close\r\n"
  3718. if (Option["user-agent"])
  3719. header = header "User-Agent: " Option["user-agent"] "\r\n"
  3720. if (Cookie)
  3721. header = header "Cookie: " Cookie "\r\n"
  3722. content = NULLSTR; isBody = 0
  3723. print header |& HttpService
  3724. while ((HttpService |& getline) > 0) {
  3725. if (isBody)
  3726. content = content ? content "\r\n" $0 : $0
  3727. else if (length($0) <= 1)
  3728. isBody = 1
  3729. }
  3730. close(HttpService)
  3731. if (!TempFile)
  3732. TempFile = getOutput("mktemp")
  3733. printf("%s", content) > TempFile
  3734. close(TempFile)
  3735. return TempFile
  3736. }
  3737. function bingWebTranslateUrl(uri, sl, tl, hl) {
  3738. return "http://www.microsofttranslator.com/bv.aspx?"\
  3739. "from=" sl "&to=" tl "&a=" uri
  3740. }
  3741. function bingRequestUrl(text, sl, tl, hl) {
  3742. return HttpPathPrefix "/translator/api/Dictionary/Lookup?"\
  3743. "from=" sl "&to=" tl "&text=" preprocess(text)
  3744. }
  3745. function bingPostRequestUrl(text, sl, tl, hl, type) {
  3746. if (type == "translate")
  3747. return HttpPathPrefix "/ttranslate?&IG=" IG "&IID=translator.5032.2"
  3748. else if (type == "translationlookup")
  3749. return HttpPathPrefix "/ttranslationlookup?&IG=" IG "&IID=translator.5032.2"
  3750. else if (type == "transliterate")
  3751. return HttpPathPrefix "/ttransliterate?&IG=" IG "&IID=translator.5032.1"
  3752. else # type == "detect"
  3753. return HttpPathPrefix "/tdetect?&IG=" IG "&IID=translator.5032.2"
  3754. }
  3755. function bingPostRequestContentType(text, sl, tl, hl, type) {
  3756. return "application/x-www-form-urlencoded"
  3757. }
  3758. function bingPostRequestBody(text, sl, tl, hl, type) {
  3759. if (type == "translate")
  3760. return "&text=" quote(text) "&from=" sl "&to=" tl
  3761. else if (type == "translationlookup")
  3762. return "&text=" quote(text) "&from=" sl "&to=" tl
  3763. else if (type == "transliterate")
  3764. return "&text=" quote(text) "&language=" sl "&toScript=" "latn"
  3765. else # type == "detect"
  3766. return "&text=" quote(text)
  3767. }
  3768. function bingTranslate(text, sl, tl, hl,
  3769. isVerbose, toSpeech, returnPlaylist, returnIl,
  3770. r,
  3771. content, tokens, ast,
  3772. _sl, _tl, _hl, il, isPhonetic,
  3773. translation,
  3774. wShowOriginal, wShowTranslation, wShowLanguages,
  3775. group, temp) {
  3776. isPhonetic = match(tl, /^@/)
  3777. tl = substr(tl, 1 + isPhonetic)
  3778. if (!getCode(tl)) {
  3779. w("[WARNING] Unknown target language code: " tl)
  3780. } else if (isRTL(tl)) {
  3781. if (!FriBidi)
  3782. w("[WARNING] " getName(tl) " is a right-to-left language, but FriBidi is not found.")
  3783. }
  3784. _sl = getCode(sl); if (!_sl) _sl = sl
  3785. _tl = getCode(tl); if (!_tl) _tl = tl
  3786. _hl = getCode(hl); if (!_hl) _hl = hl
  3787. bingSetIG()
  3788. il = postResponse(text, _sl, _tl, _hl, "detect")
  3789. if (!il) {
  3790. e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
  3791. ExitCode = 1
  3792. return
  3793. }
  3794. returnIl[0] = il
  3795. if (Option["verbose"] < -1)
  3796. return il
  3797. if (Option["verbose"] < 0)
  3798. return getList(il)
  3799. if (_sl == "auto") _sl = il
  3800. if (_sl == "bs") _sl = "bs-Latn"
  3801. if (_sl == "zh-CN") _sl = "zh-CHS"
  3802. if (_sl == "zh-TW") _sl = "zh-CHT"
  3803. if (_tl == "bs") _tl = "bs-Latn"
  3804. if (_tl == "zh-CN") _tl = "zh-CHS"
  3805. if (_tl == "zh-TW") _tl = "zh-CHT"
  3806. content = postResponse(text, _sl, _tl, _hl, "translate")
  3807. if (Option["dump"])
  3808. return content
  3809. tokenize(tokens, content)
  3810. parseJson(ast, tokens)
  3811. l(content, "content", 1, 1)
  3812. l(tokens, "tokens", 1, 0, 1)
  3813. l(ast, "ast")
  3814. if (!isarray(ast) || !anything(ast)) {
  3815. e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
  3816. ExitCode = 1
  3817. return
  3818. } else if (ast[0 SUBSEP "statusCode"] != "200") {
  3819. e("[ERROR] statusCode: " ast[0 SUBSEP "statusCode"])
  3820. ExitCode = 1
  3821. return
  3822. }
  3823. translation = unparameterize(ast[0 SUBSEP "translationResponse"])
  3824. wShowTranslationPhonetics = Option["show-translation-phonetics"]
  3825. if (wShowTranslationPhonetics) {
  3826. split(_tl, group, "-")
  3827. content = postResponse(translation, group[1], group[1], _hl, "transliterate")
  3828. phonetics = unparameterize(content)
  3829. if (phonetics == translation) phonetics = ""
  3830. }
  3831. if (!isVerbose) {
  3832. r = isPhonetic && phonetics ?
  3833. prettify("brief-translation-phonetics", join(phonetics, " ")) :
  3834. prettify("brief-translation", s(translation, tl))
  3835. } else {
  3836. wShowOriginal = Option["show-original"]
  3837. wShowTranslation = Option["show-translation"]
  3838. wShowLanguages = Option["show-languages"]
  3839. wShowDictionary = Option["show-dictionary"]
  3840. wShowOriginalPhonetics = Option["show-original-phonetics"]
  3841. if (wShowOriginalPhonetics) {
  3842. split(il, group, "-")
  3843. content = postResponse(text, group[1], group[1], _hl, "transliterate")
  3844. oPhonetics = unparameterize(content)
  3845. if (oPhonetics == text) oPhonetics = ""
  3846. }
  3847. if (!oPhonetics) wShowOriginalPhonetics = 0
  3848. if (!phonetics) wShowTranslationPhonetics = 0
  3849. if (wShowOriginal) {
  3850. if (r) r = r RS RS
  3851. r = r m("-- display original text")
  3852. r = r prettify("original", s(text, il))
  3853. if (wShowOriginalPhonetics)
  3854. r = r RS prettify("original-phonetics", showPhonetics(join(oPhonetics, " "), il))
  3855. }
  3856. if (wShowTranslation) {
  3857. if (r) r = r RS RS
  3858. r = r m("-- display major translation")
  3859. r = r prettify("translation", s(translation, tl))
  3860. if (wShowTranslationPhonetics)
  3861. r = r RS prettify("translation-phonetics", showPhonetics(join(phonetics, " "), tl))
  3862. }
  3863. if (wShowLanguages) {
  3864. if (r) r = r RS RS
  3865. r = r m("-- display source language -> target language")
  3866. temp = Option["fmt-languages"]
  3867. if (!temp) temp = "[ %s -> %t ]"
  3868. split(temp, group, /(%s|%S|%t|%T)/)
  3869. r = r prettify("languages", group[1])
  3870. if (temp ~ /%s/)
  3871. r = r prettify("languages-sl", getDisplay(il))
  3872. if (temp ~ /%S/)
  3873. r = r prettify("languages-sl", getName(il))
  3874. r = r prettify("languages", group[2])
  3875. if (temp ~ /%t/)
  3876. r = r prettify("languages-tl", getDisplay(tl))
  3877. if (temp ~ /%T/)
  3878. r = r prettify("languages-tl", getName(tl))
  3879. r = r prettify("languages", group[3])
  3880. }
  3881. if (wShowDictionary && false) {
  3882. dicContent = getResponse(text, il, _tl, _hl)
  3883. tokenize(dicTokens, dicContent)
  3884. parseJson(dicAst, dicTokens)
  3885. if (anything(dicAst)) {
  3886. if (r) r = r RS
  3887. r = r m("-- display dictionary entries")
  3888. }
  3889. }
  3890. }
  3891. if (toSpeech) {
  3892. returnPlaylist[0]["text"] = translation
  3893. returnPlaylist[0]["tl"] = tl
  3894. }
  3895. return r
  3896. }
  3897. BEGIN { provides("yandex") }
  3898. function genSID( content, group, temp) {
  3899. content = curl("http://translate.yandex.com")
  3900. match(content, /SID:[[:space:]]*'([^']+)'/, group)
  3901. if (group[1]) {
  3902. split(group[1], temp, ".")
  3903. SID = reverse(temp[1]) "." reverse(temp[2]) "." reverse(temp[3])
  3904. } else {
  3905. e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
  3906. exit 1
  3907. }
  3908. }
  3909. function yandexInit() {
  3910. genSID()
  3911. YandexWebTranslate = "z5h64q92x9.net"
  3912. HttpProtocol = "http://"
  3913. HttpHost = "translate.yandex.net"
  3914. HttpPort = 80
  3915. }
  3916. function yandexRequestUrl(text, sl, tl, hl, group) {
  3917. split(sl, group, "-"); sl = group[1]
  3918. split(tl, group, "-"); tl = group[1]
  3919. return HttpPathPrefix "/api/v1/tr.json/translate?"\
  3920. "id=" SID "-0-0&srv=tr-text"\
  3921. "&text=" preprocess(text) "&lang=" (sl == "auto" ? tl : sl "-" tl)
  3922. }
  3923. function yandexPostRequestBody(text, sl, tl, hl, type) {
  3924. return "text=" quote(text) "&lang=" sl
  3925. }
  3926. function yandexGetDictionaryResponse(text, sl, tl, hl, content, header, isBody, url) {
  3927. split(sl, group, "-"); sl = group[1]
  3928. split(tl, group, "-"); tl = group[1]
  3929. url = "http://dictionary.yandex.net/dicservice.json/lookupMultiple?"\
  3930. "&text=" preprocess(text) "&dict=" sl "-" tl
  3931. content = curl(url)
  3932. return assert(content, "[ERROR] Null response.")
  3933. }
  3934. function yandexTTSUrl(text, tl,
  3935. speaker, emotion, i, group) {
  3936. speaker = NULLSTR
  3937. emotion = NULLSTR
  3938. split(Option["narrator"], group, ",")
  3939. for (i in group) {
  3940. if (group[i] ~ /^(g(ood)?|n(eutral)?|e(vil)?)$/)
  3941. emotion = group[i]
  3942. else if (group[i] ~ /^(f(emale)?|w(oman)?)$/)
  3943. speaker = "alyss"
  3944. else if (group[i] ~ /^m(ale|an)?$/)
  3945. speaker = "zahar"
  3946. else
  3947. speaker = group[i]
  3948. }
  3949. switch (tl) {
  3950. case "ar": tl = "ar_AE"; break
  3951. case "cs": tl = "cs_CZ"; break
  3952. case "da": tl = "da_DK"; break
  3953. case "de": tl = "de_DE"; break
  3954. case "el": tl = "el_GR"; break
  3955. case "en": tl = "en_GB"; break
  3956. case "es": tl = "es_ES"; break
  3957. case "fi": tl = "fi_FI"; break
  3958. case "fr": tl = "fr_FR"; break
  3959. case "it": tl = "it_IT"; break
  3960. case "nl": tl = "nl_NL"; break
  3961. case "no": tl = "no_NO"; break
  3962. case "pl": tl = "pl_PL"; break
  3963. case "pt": tl = "pt_PT"; break
  3964. case "ru": tl = "ru_RU"; break
  3965. case "sv": tl = "sv_SE"; break
  3966. case "tr": tl = "tr_TR"; break
  3967. default: tl = NULLSTR
  3968. }
  3969. return HttpProtocol "tts.voicetech.yandex.net" "/tts?"\
  3970. "text=" preprocess(text) (tl ? "&lang=" tl : tl)\
  3971. (speaker ? "&speaker=" speaker : speaker)\
  3972. (emotion ? "&emotion=" emotion : emotion)\
  3973. "&format=mp3" "&quality=hi"
  3974. }
  3975. function yandexWebTranslateUrl(uri, sl, tl, hl) {
  3976. gsub(/:\/\//, "/", uri)
  3977. return HttpProtocol YandexWebTranslate "/proxy_u/"\
  3978. (sl == "auto" ? tl : sl "-" tl)"/" uri
  3979. }
  3980. function yandexTranslate(text, sl, tl, hl,
  3981. isVerbose, toSpeech, returnPlaylist, returnIl,
  3982. r,
  3983. content, tokens, ast,
  3984. _sl, _tl, _hl, il, isPhonetic,
  3985. translation,
  3986. wShowOriginal, wShowTranslation, wShowLanguages,
  3987. wShowDictionary, dicContent, dicTokens, dicAst,
  3988. i, syn, mean,
  3989. group, temp) {
  3990. isPhonetic = match(tl, /^@/)
  3991. tl = substr(tl, 1 + isPhonetic)
  3992. if (!getCode(tl)) {
  3993. w("[WARNING] Unknown target language code: " tl)
  3994. } else if (isRTL(tl)) {
  3995. if (!FriBidi)
  3996. w("[WARNING] " getName(tl) " is a right-to-left language, but FriBidi is not found.")
  3997. }
  3998. _sl = getCode(sl); if (!_sl) _sl = sl
  3999. _tl = getCode(tl); if (!_tl) _tl = tl
  4000. _hl = getCode(hl); if (!_hl) _hl = hl
  4001. content = getResponse(text, _sl, _tl, _hl)
  4002. if (Option["dump"])
  4003. return content
  4004. tokenize(tokens, content)
  4005. parseJson(ast, tokens)
  4006. l(content, "content", 1, 1)
  4007. l(tokens, "tokens", 1, 0, 1)
  4008. l(ast, "ast")
  4009. if (!isarray(ast) || !anything(ast)) {
  4010. e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
  4011. ExitCode = 1
  4012. return
  4013. }
  4014. if (ast[0 SUBSEP "code"] != "200") {
  4015. e("[ERROR] " unparameterize(ast[0 SUBSEP "message"]))
  4016. ExitCode = 1
  4017. return
  4018. }
  4019. translation = unparameterize(ast[0 SUBSEP "text" SUBSEP 0])
  4020. wShowTranslationPhonetics = Option["show-translation-phonetics"]
  4021. if (wShowTranslationPhonetics) {
  4022. split(_tl, group, "-")
  4023. data = yandexPostRequestBody(translation, group[1], group[1], _hl, "translit")
  4024. content = curlPost("https://translate.yandex.net/translit/translit", data)
  4025. phonetics = (content ~ /not supported$/) ? "" : unparameterize(content)
  4026. }
  4027. split(unparameterize(ast[0 SUBSEP "lang"]), group, "-")
  4028. returnIl[0] = il = group[1]
  4029. if (Option["verbose"] < -1)
  4030. return il
  4031. else if (Option["verbose"] < 0)
  4032. return getList(il)
  4033. if (!isVerbose) {
  4034. r = isPhonetic && phonetics ?
  4035. prettify("brief-translation-phonetics", join(phonetics, " ")) :
  4036. prettify("brief-translation", s(translation, tl))
  4037. } else {
  4038. wShowOriginal = Option["show-original"]
  4039. wShowTranslation = Option["show-translation"]
  4040. wShowLanguages = Option["show-languages"]
  4041. wShowDictionary = Option["show-dictionary"]
  4042. wShowOriginalPhonetics = Option["show-original-phonetics"]
  4043. if (wShowTranslationPhonetics) {
  4044. split(il, group, "-")
  4045. data = yandexPostRequestBody(text, group[1], group[1], _hl, "translit")
  4046. content = curlPost("https://translate.yandex.net/translit/translit", data)
  4047. oPhonetics = (content ~ /not supported$/) ? "" : unparameterize(content)
  4048. }
  4049. if (!oPhonetics) wShowOriginalPhonetics = 0
  4050. if (!phonetics) wShowTranslationPhonetics = 0
  4051. if (wShowOriginal) {
  4052. if (r) r = r RS RS
  4053. r = r m("-- display original text & phonetics")
  4054. r = r prettify("original", s(text, il))
  4055. if (wShowOriginalPhonetics)
  4056. r = r RS prettify("original-phonetics", showPhonetics(join(oPhonetics, " "), il))
  4057. }
  4058. if (wShowTranslation) {
  4059. if (r) r = r RS RS
  4060. r = r m("-- display major translation")
  4061. r = r prettify("translation", s(translation, tl))
  4062. if (wShowTranslationPhonetics)
  4063. r = r RS prettify("translation-phonetics", showPhonetics(join(phonetics, " "), tl))
  4064. }
  4065. if (wShowLanguages) {
  4066. if (r) r = r RS RS
  4067. r = r m("-- display source language -> target language")
  4068. temp = Option["fmt-languages"]
  4069. if (!temp) temp = "[ %s -> %t ]"
  4070. split(temp, group, /(%s|%S|%t|%T)/)
  4071. r = r prettify("languages", group[1])
  4072. if (temp ~ /%s/)
  4073. r = r prettify("languages-sl", getDisplay(il))
  4074. if (temp ~ /%S/)
  4075. r = r prettify("languages-sl", getName(il))
  4076. r = r prettify("languages", group[2])
  4077. if (temp ~ /%t/)
  4078. r = r prettify("languages-tl", getDisplay(tl))
  4079. if (temp ~ /%T/)
  4080. r = r prettify("languages-tl", getName(tl))
  4081. r = r prettify("languages", group[3])
  4082. }
  4083. if (wShowDictionary && false) {
  4084. dicContent = yandexGetDictionaryResponse(text, il, _tl, _hl)
  4085. tokenize(dicTokens, dicContent)
  4086. parseJson(dicAst, dicTokens)
  4087. if (anything(dicAst)) {
  4088. if (r) r = r RS
  4089. r = r m("-- display dictionary entries")
  4090. saveSortedIn = PROCINFO["sorted_in"]
  4091. PROCINFO["sorted_in"] = "@ind_num_asc"
  4092. for (i in dicAst) {
  4093. if (i ~ "^0" SUBSEP "def" SUBSEP "[[:digit:]]+" SUBSEP\
  4094. "pos$") {
  4095. r = r RS prettify("dictionary-word-class", s((literal(dicAst[i])), hl))
  4096. syn = mean = ""
  4097. }
  4098. if (i ~ "^0" SUBSEP "def" SUBSEP "[[:digit:]]+" SUBSEP\
  4099. "tr" SUBSEP "[[:digit:]]+" SUBSEP\
  4100. "mean" SUBSEP "[[:digit:]]+" SUBSEP "text") {
  4101. if (mean) {
  4102. mean = mean prettify("dictionary-explanation", ", ")\
  4103. prettify("dictionary-explanation-item", s((literal(dicAst[i])), sl))
  4104. } else {
  4105. mean = prettify("dictionary-explanation-item", s((literal(dicAst[i])), sl))
  4106. }
  4107. }
  4108. if (i ~ "^0" SUBSEP "def" SUBSEP "[[:digit:]]+" SUBSEP\
  4109. "tr" SUBSEP "[[:digit:]]+" SUBSEP\
  4110. "syn" SUBSEP "[[:digit:]]+" SUBSEP "text") {
  4111. if (syn) {
  4112. syn = syn prettify("dictionary-explanation", ", ")\
  4113. prettify("dictionary-word", s((literal(dicAst[i])), il))
  4114. } else {
  4115. syn = prettify("dictionary-word", s((literal(dicAst[i])), il))
  4116. }
  4117. }
  4118. if (i ~ "^0" SUBSEP "def" SUBSEP "[[:digit:]]+" SUBSEP\
  4119. "tr" SUBSEP "[[:digit:]]+" SUBSEP "text$") {
  4120. text = prettify("dictionary-word", s((literal(dicAst[i])), il))
  4121. if (syn) {
  4122. r = r RS ins(1, text prettify("dictionary-explanation", ", ") syn)
  4123. } else {
  4124. r = r RS ins(1, text)
  4125. }
  4126. r = r RS ins(2, mean)
  4127. syn = mean = ""
  4128. }
  4129. }
  4130. PROCINFO["sorted_in"] = saveSortedIn
  4131. }
  4132. }
  4133. }
  4134. if (toSpeech) {
  4135. returnPlaylist[0]["text"] = translation
  4136. returnPlaylist[0]["tl"] = tl
  4137. }
  4138. return r
  4139. }
  4140. BEGIN { provides("apertium") }
  4141. function apertiumInit() {
  4142. HttpProtocol = "http://"
  4143. HttpHost = "www.apertium.org"
  4144. HttpPort = 80
  4145. }
  4146. function apertiumRequestUrl(text, sl, tl, hl) {
  4147. return HttpPathPrefix "/apy/translate?"\
  4148. "langpair=" preprocess(sl) "|" preprocess(tl)\
  4149. "&q=" preprocess(text)
  4150. }
  4151. function apertiumTTSUrl(text, tl, narrator) {
  4152. }
  4153. function apertiumWebTranslateUrl(uri, sl, tl, hl) {
  4154. }
  4155. function apertiumTranslate(text, sl, tl, hl,
  4156. isVerbose, toSpeech, returnPlaylist, returnIl,
  4157. r,
  4158. content, tokens, ast,
  4159. _sl, _tl, _hl, il,
  4160. translation,
  4161. wShowOriginal, wShowTranslation, wShowLanguages,
  4162. group, temp) {
  4163. if (!getCode(tl)) {
  4164. w("[WARNING] Unknown target language code: " tl)
  4165. } else if (isRTL(tl)) {
  4166. if (!FriBidi)
  4167. w("[WARNING] " getName(tl) " is a right-to-left language, but FriBidi is not found.")
  4168. }
  4169. _sl = getCode(sl); if (!_sl) _sl = sl
  4170. _tl = getCode(tl); if (!_tl) _tl = tl
  4171. _hl = getCode(hl); if (!_hl) _hl = hl
  4172. _sl = "auto" == _sl ? "en" : _sl
  4173. content = getResponse(text, _sl, _tl, _hl)
  4174. if (Option["dump"])
  4175. return content
  4176. tokenize(tokens, content)
  4177. parseJson(ast, tokens)
  4178. l(content, "content", 1, 1)
  4179. l(tokens, "tokens", 1, 0, 1)
  4180. l(ast, "ast")
  4181. if (!isarray(ast) || !anything(ast)) {
  4182. e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
  4183. ExitCode = 1
  4184. return
  4185. }
  4186. translation = uprintf(unquote(unparameterize(ast[0 SUBSEP "responseData" SUBSEP "translatedText"])))
  4187. returnIl[0] = il = _sl
  4188. if (Option["verbose"] < -1)
  4189. return il
  4190. else if (Option["verbose"] < 0)
  4191. return getList(il)
  4192. if (!isVerbose) {
  4193. r = translation
  4194. } else {
  4195. wShowOriginal = Option["show-original"]
  4196. wShowTranslation = Option["show-translation"]
  4197. wShowLanguages = Option["show-languages"]
  4198. if (wShowOriginal) {
  4199. if (r) r = r RS RS
  4200. r = r m("-- display original text")
  4201. r = r prettify("original", s(text, il))
  4202. }
  4203. if (wShowTranslation) {
  4204. if (r) r = r RS RS
  4205. r = r m("-- display major translation")
  4206. r = r prettify("translation", s(translation, tl))
  4207. }
  4208. if (wShowLanguages) {
  4209. if (r) r = r RS RS
  4210. r = r m("-- display source language -> target language")
  4211. temp = Option["fmt-languages"]
  4212. if (!temp) temp = "[ %s -> %t ]"
  4213. split(temp, group, /(%s|%S|%t|%T)/)
  4214. r = r prettify("languages", group[1])
  4215. if (temp ~ /%s/)
  4216. r = r prettify("languages-sl", getDisplay(il))
  4217. if (temp ~ /%S/)
  4218. r = r prettify("languages-sl", getName(il))
  4219. r = r prettify("languages", group[2])
  4220. if (temp ~ /%t/)
  4221. r = r prettify("languages-tl", getDisplay(tl))
  4222. if (temp ~ /%T/)
  4223. r = r prettify("languages-tl", getName(tl))
  4224. r = r prettify("languages", group[3])
  4225. }
  4226. }
  4227. if (toSpeech) {
  4228. returnPlaylist[0]["text"] = translation
  4229. returnPlaylist[0]["tl"] = tl
  4230. }
  4231. return r
  4232. }
  4233. BEGIN {
  4234. provides("spell")
  4235. provides("aspell")
  4236. provides("hunspell")
  4237. }
  4238. function spellInit() {
  4239. Ispell = detectProgram("aspell", "--version") ? "aspell" :
  4240. (detectProgram("hunspell", "--version") ? "hunspell" : "")
  4241. if (!Ispell) {
  4242. e("[ERROR] Spell checker (aspell or hunspell) not found.")
  4243. exit 1
  4244. }
  4245. }
  4246. function aspellInit() {
  4247. if (!(Ispell = detectProgram("aspell", "--version") ? "aspell" : "")) {
  4248. e("[ERROR] Spell checker (aspell) not found.")
  4249. exit 1
  4250. }
  4251. }
  4252. function hunspellInit() {
  4253. if (!(Ispell = detectProgram("hunspell", "--version") ? "hunspell" : "")) {
  4254. e("[ERROR] Spell checker (hunspell) not found.")
  4255. exit 1
  4256. }
  4257. }
  4258. function spellTranslate(text, sl, tl, hl,
  4259. isVerbose, toSpeech, returnPlaylist, returnIl,
  4260. args, i, j, r, line, group, word, sug) {
  4261. args = " -a" (sl != "auto" ? " -d " sl : "")
  4262. if (system("echo" PIPE Ispell args SUPOUT SUPERR)) {
  4263. e("[ERROR] No dictionary for language: " sl)
  4264. exit 1
  4265. }
  4266. i = 1
  4267. r = ""
  4268. while ((("echo " parameterize(text) PIPE Ispell args SUPERR) |& getline line) > 0) {
  4269. match(line,
  4270. /^& (.*) [[:digit:]]+ [[:digit:]]+: ([^,]+)(, ([^,]+))?(, ([^,]+))?/,
  4271. group)
  4272. if (RSTART) {
  4273. ExitCode = 1
  4274. word = group[1]
  4275. sug = "[" group[2]
  4276. if (group[4]) sug = sug "|" group[4]
  4277. if (group[6]) sug = sug "|" group[6]
  4278. sug = sug "]"
  4279. j = i + index(substr(text, i), word) - 1
  4280. r = r substr(text, i, j - i)
  4281. r = r ansi("bold", ansi("red", word)) ansi("yellow", sug)
  4282. i = j + length(word)
  4283. }
  4284. }
  4285. r = r substr(text, i)
  4286. return r
  4287. }
  4288. function aspellTranslate(text, sl, tl, hl,
  4289. isVerbose, toSpeech, returnPlaylist, returnIl) {
  4290. return spellTranslate(text, sl, tl, hl)
  4291. }
  4292. function hunspellTranslate(text, sl, tl, hl,
  4293. isVerbose, toSpeech, returnPlaylist, returnIl) {
  4294. return spellTranslate(text, sl, tl, hl)
  4295. }
  4296. BEGIN { provides("deepl") }
  4297. function deeplInit() {
  4298. HttpProtocol = "http://"
  4299. HttpHost = "www.deepl.com"
  4300. HttpPort = 80
  4301. }
  4302. function deeplRequestUrl(text, sl, tl, hl) {
  4303. }
  4304. function deeplTTSUrl(text, tl, narrator) {
  4305. }
  4306. function deeplWebTranslateUrl(uri, sl, tl, hl) {
  4307. }
  4308. function deeplPost(text, sl, tl, hl,
  4309. content, data, url) {
  4310. data = "{\"jsonrpc\":\"2.0\",\"method\":\"LMT_handle_jobs\","
  4311. data = data "\"params\":{\"jobs\":[{\"kind\":\"default\","
  4312. data = data "\"raw_en_sentence\":" parameterize(text, "\"") "}],"
  4313. data = data "\"lang\":{\"user_preferred_langs\":[\"" hl "\"],"
  4314. data = data "\"source_lang_user_selected\":\"" sl "\","
  4315. data = data "\"target_lang\":\"" tl "\"},"
  4316. data = data "\"priority\":1},\"id\":1}"
  4317. l(data)
  4318. url = "https://www.deepl.com/jsonrpc"
  4319. content = curlPost(url, data)
  4320. return assert(content, "[ERROR] Null response.")
  4321. }
  4322. function deeplTranslate(text, sl, tl, hl,
  4323. isVerbose, toSpeech, returnPlaylist, returnIl,
  4324. r,
  4325. content, tokens, ast,
  4326. _sl, _tl, _hl, il,
  4327. translation, translations,
  4328. wShowOriginal, wShowTranslation,
  4329. wShowLanguages, wShowAlternatives,
  4330. group, temp) {
  4331. if (!getCode(tl)) {
  4332. w("[WARNING] Unknown target language code: " tl)
  4333. } else if (isRTL(tl)) {
  4334. if (!FriBidi)
  4335. w("[WARNING] " getName(tl) " is a right-to-left language, but FriBidi is not found.")
  4336. }
  4337. _sl = getCode(sl); if (!_sl) _sl = sl
  4338. _tl = getCode(tl); if (!_tl) _tl = tl
  4339. _hl = getCode(hl); if (!_hl) _hl = hl
  4340. if (_sl != "auto") _sl = toupper(_sl)
  4341. if (_tl != "auto") _tl = toupper(_tl)
  4342. if (_hl != "auto") _hl = toupper(_hl)
  4343. content = deeplPost(text, _sl, _tl, _hl)
  4344. if (Option["dump"])
  4345. return content
  4346. tokenize(tokens, content)
  4347. parseJson(ast, tokens)
  4348. l(content, "content", 1, 1)
  4349. l(tokens, "tokens", 1, 0, 1)
  4350. l(ast, "ast")
  4351. if (!isarray(ast) || !anything(ast)) {
  4352. e("[ERROR] Oops! Something went wrong and I can't translate it for you :(")
  4353. ExitCode = 1
  4354. return
  4355. }
  4356. saveSortedIn = PROCINFO["sorted_in"]
  4357. PROCINFO["sorted_in"] = "compareByIndexFields"
  4358. for (i in ast) {
  4359. if (i ~ "^0" SUBSEP "result" SUBSEP "translations" SUBSEP 0 SUBSEP "beams" SUBSEP "[[:digit:]]+" SUBSEP "postprocessed_sentence$") {
  4360. append(translations, uprintf(unquote(unparameterize(ast[i]))))
  4361. }
  4362. }
  4363. PROCINFO["sorted_in"] = saveSortedIn
  4364. translation = translations[0]
  4365. returnIl[0] = il = tolower(unparameterize(ast[0 SUBSEP "result" SUBSEP "source_lang"]))
  4366. if (Option["verbose"] < -1)
  4367. return il
  4368. else if (Option["verbose"] < 0)
  4369. return getList(il)
  4370. if (!isVerbose) {
  4371. r = translation
  4372. } else {
  4373. wShowOriginal = Option["show-original"]
  4374. wShowTranslation = Option["show-translation"]
  4375. wShowLanguages = Option["show-languages"]
  4376. wShowAlternatives = Option["show-alternatives"]
  4377. if (length(translations) <= 1) wShowAlternatives = 0
  4378. if (wShowOriginal) {
  4379. if (r) r = r RS RS
  4380. r = r m("-- display original text")
  4381. r = r prettify("original", s(text, il))
  4382. }
  4383. if (wShowTranslation) {
  4384. if (r) r = r RS RS
  4385. r = r m("-- display major translation")
  4386. r = r prettify("translation", s(translation, tl))
  4387. }
  4388. if (wShowLanguages) {
  4389. if (r) r = r RS RS
  4390. r = r m("-- display source language -> target language")
  4391. temp = Option["fmt-languages"]
  4392. if (!temp) temp = "[ %s -> %t ]"
  4393. split(temp, group, /(%s|%S|%t|%T)/)
  4394. r = r prettify("languages", group[1])
  4395. if (temp ~ /%s/)
  4396. r = r prettify("languages-sl", getDisplay(il))
  4397. if (temp ~ /%S/)
  4398. r = r prettify("languages-sl", getName(il))
  4399. r = r prettify("languages", group[2])
  4400. if (temp ~ /%t/)
  4401. r = r prettify("languages-tl", getDisplay(tl))
  4402. if (temp ~ /%T/)
  4403. r = r prettify("languages-tl", getName(tl))
  4404. r = r prettify("languages", group[3])
  4405. }
  4406. if (wShowAlternatives) {
  4407. if (r) r = r RS
  4408. r = r m("-- display alternative translations")
  4409. r = r RS ins(1, prettify("alternatives-translations-item", translations[1]))
  4410. for (i = 2; i < length(translations); i++)
  4411. r = r RS ins(1, prettify("alternatives-translations-item", translations[i]))
  4412. }
  4413. }
  4414. if (toSpeech) {
  4415. returnPlaylist[0]["text"] = translation
  4416. returnPlaylist[0]["tl"] = tl
  4417. }
  4418. return r
  4419. }
  4420. function loadOptions(script, i, j, tokens, name, value) {
  4421. tokenize(tokens, script)
  4422. for (i in tokens) {
  4423. if (tokens[i] ~ /^:/) {
  4424. name = substr(tokens[i], 2)
  4425. value = tokens[i + 1]
  4426. if (value ~ /^[+-]?((0|[1-9][0-9]*)|[.][0-9]*|(0|[1-9][0-9]*)[.][0-9]*)([Ee][+-]?[0-9]+)?$/) {
  4427. delete Option[name]
  4428. Option[name] = value
  4429. } else if (value == "false" || value == "true") {
  4430. delete Option[name]
  4431. Option[name] = yn(value)
  4432. } else if (value ~ /^".*"$/) {
  4433. delete Option[name]
  4434. Option[name] = literal(value)
  4435. } else if (value == "[") {
  4436. delete Option[name]
  4437. for (j = 1; tokens[i + j + 1] && tokens[i + j + 1] != "]"; j++) {
  4438. if (tokens[i + j + 1] ~ /^".*"$/)
  4439. Option[name][j] = literal(tokens[i + j + 1])
  4440. else {
  4441. e("[ERROR] Malformed configuration.")
  4442. return
  4443. }
  4444. }
  4445. } else {
  4446. e("[ERROR] Malformed configuration.")
  4447. return
  4448. }
  4449. }
  4450. }
  4451. }
  4452. function upgrade( i, newVersion, registry, tokens) {
  4453. RegistryIndex = "https://raw.githubusercontent.com/soimort/translate-shell/registry/index.trans"
  4454. registry = curl(RegistryIndex)
  4455. if (!registry) {
  4456. e("[ERROR] Failed to check for upgrade.")
  4457. ExitCode = 1
  4458. return
  4459. }
  4460. tokenize(tokens, registry)
  4461. for (i in tokens)
  4462. if (tokens[i] == ":translate-shell")
  4463. newVersion = literal(tokens[i + 1])
  4464. if (newerVersion(newVersion, Version)) {
  4465. w("Current version: \t" Version)
  4466. w("New version available: \t" newVersion)
  4467. w("Download from: \t" "https://www.soimort.org/translate-shell/trans")
  4468. } else {
  4469. w("Current version: \t" Version)
  4470. w("Already up-to-date.")
  4471. }
  4472. }
  4473. function welcome() {
  4474. if (Option["fmt-welcome-message"])
  4475. print prettify("welcome-message", Option["fmt-welcome-message"]) > STDERR
  4476. if (Option["fmt-welcome-submessage"])
  4477. print prettify("welcome-submessage", Option["fmt-welcome-submessage"]) > STDERR
  4478. }
  4479. function prompt( i, p, temp) {
  4480. p = Option["fmt-prompt"]
  4481. if (p ~ /%a/) gsub(/%a/, strftime("%a"), p)
  4482. if (p ~ /%A/) gsub(/%A/, strftime("%A"), p)
  4483. if (p ~ /%b/) gsub(/%b/, strftime("%b"), p)
  4484. if (p ~ /%B/) gsub(/%B/, strftime("%B"), p)
  4485. if (p ~ /%c/) gsub(/%c/, strftime("%c"), p)
  4486. if (p ~ /%C/) gsub(/%C/, strftime("%C"), p)
  4487. if (p ~ /%d/) gsub(/%d/, strftime("%d"), p)
  4488. if (p ~ /%D/) gsub(/%D/, strftime("%D"), p)
  4489. if (p ~ /%e/) gsub(/%e/, strftime("%e"), p)
  4490. if (p ~ /%F/) gsub(/%F/, strftime("%F"), p)
  4491. if (p ~ /%g/) gsub(/%g/, strftime("%g"), p)
  4492. if (p ~ /%G/) gsub(/%G/, strftime("%G"), p)
  4493. if (p ~ /%h/) gsub(/%h/, strftime("%h"), p)
  4494. if (p ~ /%H/) gsub(/%H/, strftime("%H"), p)
  4495. if (p ~ /%I/) gsub(/%I/, strftime("%I"), p)
  4496. if (p ~ /%j/) gsub(/%j/, strftime("%j"), p)
  4497. if (p ~ /%m/) gsub(/%m/, strftime("%m"), p)
  4498. if (p ~ /%M/) gsub(/%M/, strftime("%M"), p)
  4499. if (p ~ /%n/) gsub(/%n/, strftime("%n"), p)
  4500. if (p ~ /%p/) gsub(/%p/, strftime("%p"), p)
  4501. if (p ~ /%r/) gsub(/%r/, strftime("%r"), p)
  4502. if (p ~ /%R/) gsub(/%R/, strftime("%R"), p)
  4503. if (p ~ /%u/) gsub(/%u/, strftime("%u"), p)
  4504. if (p ~ /%U/) gsub(/%U/, strftime("%U"), p)
  4505. if (p ~ /%V/) gsub(/%V/, strftime("%V"), p)
  4506. if (p ~ /%w/) gsub(/%w/, strftime("%w"), p)
  4507. if (p ~ /%W/) gsub(/%W/, strftime("%W"), p)
  4508. if (p ~ /%x/) gsub(/%x/, strftime("%x"), p)
  4509. if (p ~ /%X/) gsub(/%X/, strftime("%X"), p)
  4510. if (p ~ /%y/) gsub(/%y/, strftime("%y"), p)
  4511. if (p ~ /%Y/) gsub(/%Y/, strftime("%Y"), p)
  4512. if (p ~ /%z/) gsub(/%z/, strftime("%z"), p)
  4513. if (p ~ /%Z/) gsub(/%Z/, strftime("%Z"), p)
  4514. if (p ~ /%_/)
  4515. gsub(/%_/, showTranslationsOf(Option["hl"]), p)
  4516. if (p ~ /%l/)
  4517. gsub(/%l/, getDisplay(Option["hl"]), p)
  4518. if (p ~ /%L/)
  4519. gsub(/%L/, getName(Option["hl"]), p)
  4520. if (p ~ /%S/)
  4521. gsub(/%S/, getName(Option["sl"]), p)
  4522. if (p ~ /%t/) {
  4523. temp = getDisplay(Option["tl"][1])
  4524. for (i = 2; i <= length(Option["tl"]); i++)
  4525. temp = temp "+" getDisplay(Option["tl"][i])
  4526. gsub(/%t/, temp, p)
  4527. }
  4528. if (p ~ /%T/) {
  4529. temp = getName(Option["tl"][1])
  4530. for (i = 2; i <= length(Option["tl"]); i++)
  4531. temp = temp "+" getName(Option["tl"][i])
  4532. gsub(/%T/, temp, p)
  4533. }
  4534. if (p ~ /%,/) {
  4535. temp = getDisplay(Option["tl"][1])
  4536. for (i = 2; i <= length(Option["tl"]); i++)
  4537. temp = temp "," getDisplay(Option["tl"][i])
  4538. gsub(/%,/, temp, p)
  4539. }
  4540. if (p ~ /%</) {
  4541. temp = getName(Option["tl"][1])
  4542. for (i = 2; i <= length(Option["tl"]); i++)
  4543. temp = temp "," getName(Option["tl"][i])
  4544. gsub(/%</, temp, p)
  4545. }
  4546. if (p ~ /%\//) {
  4547. temp = getDisplay(Option["tl"][1])
  4548. for (i = 2; i <= length(Option["tl"]); i++)
  4549. temp = temp "/" getDisplay(Option["tl"][i])
  4550. gsub(/%\//, temp, p)
  4551. }
  4552. if (p ~ /%\?/) {
  4553. temp = getName(Option["tl"][1])
  4554. for (i = 2; i <= length(Option["tl"]); i++)
  4555. temp = temp "/" getName(Option["tl"][i])
  4556. gsub(/%\?/, temp, p)
  4557. }
  4558. printf(prettify("prompt", p), getDisplay(Option["sl"])) > STDERR
  4559. }
  4560. function repl(line, command, group, name, i, value, words) {
  4561. split(line, words, " ")
  4562. command = words[1]
  4563. if (command ~ /^:(q|quit)$/) {
  4564. exit
  4565. } else if (command ~ /^:set$/) {
  4566. name = words[2]
  4567. value = words[3]
  4568. Option[name] = value
  4569. } else if (command ~ /^:show$/) {
  4570. name = words[2]
  4571. print prettify("welcome-submessage", toString(Option[name], 1, 0, 1))
  4572. } else if (command ~ /^:engine$/) {
  4573. value = words[2]
  4574. Option["engine"] = value
  4575. initHttpService()
  4576. } else {
  4577. match(command, /^[{(\[]?([[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?)?(:|=)((@?[[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?\+)*(@?[[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?)?)[})\]]?$/, group)
  4578. if (RSTART) {
  4579. if (group[1]) Option["sl"] = group[1]
  4580. if (group[4]) split(group[4], Option["tl"], "+")
  4581. line = words[2]
  4582. for (i = 3; i <= length(words); i++)
  4583. line = line " " words[i]
  4584. }
  4585. if (line) {
  4586. translate(line)
  4587. if (Option["verbose"]) printf RS
  4588. }
  4589. }
  4590. prompt()
  4591. }
  4592. function init() {
  4593. initGawk()
  4594. initBiDi()
  4595. initLocale()
  4596. initUserLang()
  4597. RS = "\n"
  4598. ExitCode = 0
  4599. Option["debug"] = 0
  4600. Option["engine"] = "google"
  4601. Option["verbose"] = 1
  4602. Option["show-original"] = 1
  4603. Option["show-original-phonetics"] = 1
  4604. Option["show-translation"] = 1
  4605. Option["show-translation-phonetics"] = 1
  4606. Option["show-prompt-message"] = 1
  4607. Option["show-languages"] = 1
  4608. Option["show-original-dictionary"] = 0
  4609. Option["show-dictionary"] = 1
  4610. Option["show-alternatives"] = 1
  4611. Option["width"] = ENVIRON["COLUMNS"] ? ENVIRON["COLUMNS"] - 2 : 0
  4612. Option["indent"] = 4
  4613. Option["no-ansi"] = 0
  4614. Option["no-autocorrect"] = 0
  4615. Option["no-bidi"] = 0
  4616. Option["no-warn"] = 0
  4617. Option["theme"] = "default"
  4618. Option["dump"] = 0
  4619. Option["play"] = 0
  4620. Option["narrator"] = "female"
  4621. Option["player"] = ENVIRON["PLAYER"]
  4622. Option["no-translate"] = 0
  4623. Option["download-audio"] = 0
  4624. Option["download-audio-as"] = NULLSTR
  4625. Option["view"] = 0
  4626. Option["pager"] = ENVIRON["PAGER"]
  4627. Option["browser"] = ENVIRON["BROWSER"]
  4628. Option["proxy"] = ENVIRON["HTTP_PROXY"] ? ENVIRON["HTTP_PROXY"] : ENVIRON["http_proxy"]
  4629. Option["user-agent"] = ENVIRON["USER_AGENT"] ? ENVIRON["USER_AGENT"] :
  4630. "Mozilla/5.0 (X11; Linux x86_64) "\
  4631. "AppleWebKit/602.1 (KHTML, like Gecko) Version/8.0 "\
  4632. "Safari/602.1 Epiphany/3.18.2"
  4633. Option["no-rlwrap"] = 0
  4634. Option["interactive"] = 0
  4635. Option["emacs"] = 0
  4636. Option["input"] = NULLSTR
  4637. Option["output"] = STDOUT
  4638. Option["hl"] = ENVIRON["HOME_LANG"] ? ENVIRON["HOME_LANG"] : UserLang
  4639. Option["sl"] = ENVIRON["SOURCE_LANG"] ? ENVIRON["SOURCE_LANG"] : "auto"
  4640. Option["tl"][1] = ENVIRON["TARGET_LANG"] ? ENVIRON["TARGET_LANG"] : UserLang
  4641. }
  4642. function initScript( file, line, script, temp) {
  4643. file = ".trans"
  4644. if (!fileExists(file)) {
  4645. file = ENVIRON["HOME"] "/.translate-shell/init.trans"
  4646. if (!fileExists(file)) {
  4647. file = ENVIRON["XDG_CONFIG_HOME"] "/translate-shell/init.trans"
  4648. if (!fileExists(file)) {
  4649. file = ENVIRON["HOME"] "/.config/translate-shell/init.trans"
  4650. if (!fileExists(file)) {
  4651. file = "/etc/translate-shell"
  4652. if (!fileExists(file)) return
  4653. }
  4654. }
  4655. }
  4656. }
  4657. InitScript = file
  4658. script = NULLSTR
  4659. while (getline line < InitScript)
  4660. script = script "\n" line
  4661. loadOptions(script)
  4662. if (!isarray(Option["tl"])) {
  4663. temp = Option["tl"]
  4664. delete Option["tl"]
  4665. Option["tl"][1] = temp
  4666. }
  4667. }
  4668. function initMisc( group, temp) {
  4669. initHttpService()
  4670. if (!Option["width"] && detectProgram("tput", "-V")) {
  4671. "tput cols" SUPERR | getline temp
  4672. Option["width"] = temp ? temp - 2 : 64
  4673. }
  4674. if (Option["no-ansi"])
  4675. delete AnsiCode
  4676. if (Option["no-bidi"])
  4677. BiDi = BiDiNoPad = NULLSTR
  4678. if (Option["no-warn"])
  4679. STDERR = "/dev/null"
  4680. if (Option["play"]) {
  4681. if (!Option["player"]) {
  4682. initAudioPlayer()
  4683. Option["player"] = AudioPlayer ? AudioPlayer : Option["player"]
  4684. if (!Option["player"])
  4685. initSpeechSynthesizer()
  4686. }
  4687. if (!Option["player"] && !SpeechSynthesizer) {
  4688. w("[WARNING] No available audio player or speech synthesizer.")
  4689. Option["play"] = 0
  4690. }
  4691. }
  4692. if (Option["view"]) {
  4693. if (!Option["pager"]) {
  4694. initPager()
  4695. Option["pager"] = Pager
  4696. }
  4697. if (!Option["pager"]) {
  4698. w("[WARNING] No available terminal pager.")
  4699. Option["view"] = 0
  4700. }
  4701. }
  4702. if (!Option["browser"]) {
  4703. "xdg-mime query default text/html" SUPERR | getline Option["browser"]
  4704. match(Option["browser"], "(.*).desktop$", group)
  4705. Option["browser"] = group[1]
  4706. }
  4707. }
  4708. BEGIN {
  4709. init()
  4710. if (!(belongsTo("-no-init", ARGV) || belongsTo("--no-init", ARGV)))
  4711. initScript()
  4712. pos = 0
  4713. noargc = 0
  4714. while (ARGV[++pos]) {
  4715. match(ARGV[pos], /^--?(V|vers(i(on?)?)?)$/)
  4716. if (RSTART) {
  4717. InfoOnly = "version"
  4718. continue
  4719. }
  4720. match(ARGV[pos], /^--?(H|h(e(lp?)?)?)$/)
  4721. if (RSTART) {
  4722. InfoOnly = "help"
  4723. continue
  4724. }
  4725. match(ARGV[pos], /^--?(M|m(a(n(u(al?)?)?)?)?)$/)
  4726. if (RSTART) {
  4727. InfoOnly = "manual"
  4728. continue
  4729. }
  4730. match(ARGV[pos], /^--?(T|ref(e(r(e(n(ce?)?)?)?)?)?)$/)
  4731. if (RSTART) {
  4732. InfoOnly = "reference"
  4733. continue
  4734. }
  4735. match(ARGV[pos], /^--?r$/)
  4736. if (RSTART) {
  4737. w("[WARNING] Option '-r' has been deprecated since version 0.9.\n"\
  4738. " Use option '-T' or '-reference' instead.")
  4739. exit 1
  4740. }
  4741. match(ARGV[pos], /^--?(R|reference-e(n(g(l(i(sh?)?)?)?)?)?)$/)
  4742. if (RSTART) {
  4743. InfoOnly = "reference-english"
  4744. continue
  4745. }
  4746. match(ARGV[pos], /^--?(L|list)(=(.*)?)?$/, group)
  4747. if (RSTART) {
  4748. InfoOnly = "list"
  4749. if (group[2]) {
  4750. if (group[3]) split(group[3], Option["tl"], "+")
  4751. } else
  4752. split(ARGV[++pos], Option["tl"], "+")
  4753. continue
  4754. }
  4755. match(ARGV[pos], /^--?(S|list-e(n(g(i(n(es?)?)?)?)?)?)$/)
  4756. if (RSTART) {
  4757. InfoOnly = "list-engines"
  4758. continue
  4759. }
  4760. match(ARGV[pos], /^--?(U|upgrade)$/)
  4761. if (RSTART) {
  4762. InfoOnly = "upgrade"
  4763. continue
  4764. }
  4765. match(ARGV[pos], /^--?(N|nothing)$/)
  4766. if (RSTART) {
  4767. InfoOnly = "nothing"
  4768. continue
  4769. }
  4770. match(ARGV[pos], /^--?(e|engine)(=(.*)?)?$/, group)
  4771. if (RSTART) {
  4772. Option["engine"] = group[2] ?
  4773. (group[3] ? group[3] : Option["engine"]) :
  4774. ARGV[++pos]
  4775. continue
  4776. }
  4777. match(ARGV[pos], /^\/(.*)$/, group)
  4778. if (RSTART) {
  4779. Option["engine"] = group[1]
  4780. continue
  4781. }
  4782. match(ARGV[pos], /^--?verbose$/)
  4783. if (RSTART) {
  4784. Option["verbose"] = 1
  4785. continue
  4786. }
  4787. match(ARGV[pos], /^--?b(r(i(ef?)?)?)?$/)
  4788. if (RSTART) {
  4789. Option["verbose"] = 0
  4790. continue
  4791. }
  4792. match(ARGV[pos], /^--?d(i(c(t(i(o(n(a(ry?)?)?)?)?)?)?)?)?$/)
  4793. if (RSTART) {
  4794. Option["show-original-dictionary"] = 1
  4795. Option["show-dictionary"] = 0
  4796. Option["show-alternatives"] = 0
  4797. continue
  4798. }
  4799. match(ARGV[pos], /^--?id(e(n(t(i(fy?)?)?)?)?)?$/)
  4800. if (RSTART) {
  4801. Option["verbose"] = Option["verbose"] - 2
  4802. continue
  4803. }
  4804. match(ARGV[pos], /^--?show-original(=(.*)?)?$/, group)
  4805. if (RSTART) {
  4806. Option["show-original"] = yn(group[1] ? group[2] : ARGV[++pos])
  4807. continue
  4808. }
  4809. match(ARGV[pos], /^--?show-original-phonetics(=(.*)?)?$/, group)
  4810. if (RSTART) {
  4811. Option["show-original-phonetics"] = yn(group[1] ? group[2] : ARGV[++pos])
  4812. continue
  4813. }
  4814. match(ARGV[pos], /^--?show-translation(=(.*)?)?$/, group)
  4815. if (RSTART) {
  4816. Option["show-translation"] = yn(group[1] ? group[2] : ARGV[++pos])
  4817. continue
  4818. }
  4819. match(ARGV[pos], /^--?show-translation-phonetics(=(.*)?)?$/, group)
  4820. if (RSTART) {
  4821. Option["show-translation-phonetics"] = yn(group[1] ? group[2] : ARGV[++pos])
  4822. continue
  4823. }
  4824. match(ARGV[pos], /^--?show-prompt-message(=(.*)?)?$/, group)
  4825. if (RSTART) {
  4826. Option["show-prompt-message"] = yn(group[1] ? group[2] : ARGV[++pos])
  4827. continue
  4828. }
  4829. match(ARGV[pos], /^--?show-languages(=(.*)?)?$/, group)
  4830. if (RSTART) {
  4831. Option["show-languages"] = yn(group[1] ? group[2] : ARGV[++pos])
  4832. continue
  4833. }
  4834. match(ARGV[pos], /^--?show-original-dictionary(=(.*)?)?$/, group)
  4835. if (RSTART) {
  4836. Option["show-original-dictionary"] = yn(group[1] ? group[2] : ARGV[++pos])
  4837. continue
  4838. }
  4839. match(ARGV[pos], /^--?show-dictionary(=(.*)?)?$/, group)
  4840. if (RSTART) {
  4841. Option["show-dictionary"] = yn(group[1] ? group[2] : ARGV[++pos])
  4842. continue
  4843. }
  4844. match(ARGV[pos], /^--?show-alternatives(=(.*)?)?$/, group)
  4845. if (RSTART) {
  4846. Option["show-alternatives"] = yn(group[1] ? group[2] : ARGV[++pos])
  4847. continue
  4848. }
  4849. match(ARGV[pos], /^--?w(i(d(th?)?)?)?(=(.*)?)?$/, group)
  4850. if (RSTART) {
  4851. Option["width"] = group[4] ?
  4852. (group[5] ? group[5] : Option["width"]) :
  4853. ARGV[++pos]
  4854. continue
  4855. }
  4856. match(ARGV[pos], /^--?indent(=(.*)?)?$/, group)
  4857. if (RSTART) {
  4858. Option["indent"] = group[1] ?
  4859. (group[2] ? group[2] : Option["indent"]) :
  4860. ARGV[++pos]
  4861. continue
  4862. }
  4863. match(ARGV[pos], /^--?theme(=(.*)?)?$/, group)
  4864. if (RSTART) {
  4865. Option["theme"] = group[1] ?
  4866. (group[2] ? group[2] : Option["theme"]) :
  4867. ARGV[++pos]
  4868. continue
  4869. }
  4870. match(ARGV[pos], /^--?no-theme$/)
  4871. if (RSTART) {
  4872. Option["theme"] = NULLSTR
  4873. continue
  4874. }
  4875. match(ARGV[pos], /^--?no-ansi$/)
  4876. if (RSTART) {
  4877. Option["no-ansi"] = 1
  4878. continue
  4879. }
  4880. match(ARGV[pos], /^--?no-auto(correct)?$/)
  4881. if (RSTART) {
  4882. Option["no-autocorrect"] = 1
  4883. continue
  4884. }
  4885. match(ARGV[pos], /^--?no-bidi/)
  4886. if (RSTART) {
  4887. Option["no-bidi"] = 1
  4888. continue
  4889. }
  4890. match(ARGV[pos], /^--?no-warn/)
  4891. if (RSTART) {
  4892. Option["no-warn"] = 1
  4893. continue
  4894. }
  4895. match(ARGV[pos], /^--?dump/)
  4896. if (RSTART) {
  4897. Option["dump"] = 1
  4898. continue
  4899. }
  4900. match(ARGV[pos], /^--?p(l(ay?)?)?$/)
  4901. if (RSTART) {
  4902. Option["play"] = 1
  4903. continue
  4904. }
  4905. match(ARGV[pos], /^--?sp(e(ak?)?)?$/)
  4906. if (RSTART) {
  4907. Option["play"] = 2
  4908. continue
  4909. }
  4910. match(ARGV[pos], /^--?(n|narrator)(=(.*)?)?$/, group)
  4911. if (RSTART) {
  4912. if (!Option["play"]) Option["play"] = 1
  4913. Option["narrator"] = group[2] ?
  4914. (group[3] ? group[3] : Option["narrator"]) :
  4915. ARGV[++pos]
  4916. continue
  4917. }
  4918. match(ARGV[pos], /^--?player(=(.*)?)?$/, group)
  4919. if (RSTART) {
  4920. if (!Option["play"]) Option["play"] = 1
  4921. Option["player"] = group[1] ?
  4922. (group[2] ? group[2] : Option["player"]) :
  4923. ARGV[++pos]
  4924. continue
  4925. }
  4926. match(ARGV[pos], /^--?no-play$/)
  4927. if (RSTART) {
  4928. Option["play"] = 0
  4929. continue
  4930. }
  4931. match(ARGV[pos], /^--?no-tran(s(l(a(te?)?)?)?)?$/)
  4932. if (RSTART) {
  4933. Option["no-translate"] = 1
  4934. continue
  4935. }
  4936. match(ARGV[pos], /^--?download-a(u(d(io?)?)?)?$/)
  4937. if (RSTART) {
  4938. Option["download-audio"] = 1
  4939. continue
  4940. }
  4941. match(ARGV[pos], /^--?download-audio-as(=(.*)?)?$/, group)
  4942. if (RSTART) {
  4943. if (!Option["download-audio"]) Option["download-audio"] = 1
  4944. Option["download-audio-as"] = group[1] ?
  4945. (group[2] ? group[2] : Option["download-audio-as"]) :
  4946. ARGV[++pos]
  4947. continue
  4948. }
  4949. match(ARGV[pos], /^--?v(i(ew?)?)?$/)
  4950. if (RSTART) {
  4951. Option["view"] = 1
  4952. continue
  4953. }
  4954. match(ARGV[pos], /^--?pager(=(.*)?)?$/, group)
  4955. if (RSTART) {
  4956. Option["view"] = 1
  4957. Option["pager"] = group[1] ?
  4958. (group[2] ? group[2] : Option["pager"]) :
  4959. ARGV[++pos]
  4960. continue
  4961. }
  4962. match(ARGV[pos], /^--?no-view$/)
  4963. if (RSTART) {
  4964. Option["view"] = 0
  4965. continue
  4966. }
  4967. match(ARGV[pos], /^--?browser(=(.*)?)?$/, group)
  4968. if (RSTART) {
  4969. Option["browser"] = group[1] ?
  4970. (group[2] ? group[2] : Option["browser"]) :
  4971. ARGV[++pos]
  4972. continue
  4973. }
  4974. match(ARGV[pos], /^--?(x|proxy)(=(.*)?)?$/, group)
  4975. if (RSTART) {
  4976. Option["proxy"] = group[2] ?
  4977. (group[3] ? group[3] : Option["proxy"]) :
  4978. ARGV[++pos]
  4979. continue
  4980. }
  4981. match(ARGV[pos], /^--?(u|user-agent)(=(.*)?)?$/, group)
  4982. if (RSTART) {
  4983. Option["user-agent"] = group[2] ?
  4984. (group[3] ? group[3] : Option["user-agent"]) :
  4985. ARGV[++pos]
  4986. continue
  4987. }
  4988. match(ARGV[pos], /^--?(I|int(e(r(a(c(t(i(ve?)?)?)?)?)?)?)?|shell)$/)
  4989. if (RSTART) {
  4990. Option["interactive"] = 1
  4991. continue
  4992. }
  4993. match(ARGV[pos], /^--?(E|emacs)$/)
  4994. if (RSTART) {
  4995. Option["emacs"] = 1
  4996. continue
  4997. }
  4998. match(ARGV[pos], /^--?no-rlwrap$/)
  4999. if (RSTART) {
  5000. Option["no-rlwrap"] = 1
  5001. continue
  5002. }
  5003. match(ARGV[pos], /^--?prompt(=(.*)?)?$/, group)
  5004. if (RSTART) {
  5005. w("[ERROR] Option '-prompt' has been deprecated since version 0.9.\n"\
  5006. " Use configuration variable 'fmt-prompt' instead.")
  5007. exit 1
  5008. }
  5009. match(ARGV[pos], /^--?prompt-color(=(.*)?)?$/, group)
  5010. if (RSTART) {
  5011. w("[ERROR] Option '-prompt-color' has been deprecated since version 0.9.\n"\
  5012. " Use configuration variable 'sgr-prompt' instead.")
  5013. exit 1
  5014. }
  5015. match(ARGV[pos], /^--?i(n(p(ut?)?)?)?(=(.*)?)?$/, group)
  5016. if (RSTART) {
  5017. Option["input"] = group[4] ?
  5018. (group[5] ? group[5] : Option["input"]) :
  5019. ARGV[++pos]
  5020. continue
  5021. }
  5022. match(ARGV[pos], /^--?o(u(t(p(ut?)?)?)?)?(=(.*)?)?$/, group)
  5023. if (RSTART) {
  5024. Option["output"] = group[5] ?
  5025. (group[6] ? group[6] : Option["output"]) :
  5026. ARGV[++pos]
  5027. continue
  5028. }
  5029. match(ARGV[pos], /^--?(l(a(ng?)?)?|hl)(=(.*)?)?$/, group)
  5030. if (RSTART) {
  5031. Option["hl"] = group[4] ?
  5032. (group[5] ? group[5] : Option["hl"]) :
  5033. ARGV[++pos]
  5034. continue
  5035. }
  5036. match(ARGV[pos], /^--?(s(o(u(r(ce?)?)?)?|l)?|f|from)(=(.*)?)?$/, group)
  5037. if (RSTART) {
  5038. Option["sl"] = group[6] ?
  5039. (group[7] ? group[7] : Option["sl"]) :
  5040. ARGV[++pos]
  5041. continue
  5042. }
  5043. match(ARGV[pos], /^--?t(a(r(g(et?)?)?)?|l|o)?(=(.*)?)?$/, group)
  5044. if (RSTART) {
  5045. if (group[5]) {
  5046. if (group[6]) split(group[6], Option["tl"], "+")
  5047. } else
  5048. split(ARGV[++pos], Option["tl"], "+")
  5049. continue
  5050. }
  5051. match(ARGV[pos], /^[{(\[]?([[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?)?(:|=)((@?[[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?\+)*(@?[[:alpha:]][[:alpha:]][[:alpha:]]?(-[[:alpha:]][[:alpha:]][[:alpha:]]?[[:alpha:]]?)?)?)[})\]]?$/, group)
  5052. if (RSTART) {
  5053. if (group[1]) Option["sl"] = group[1]
  5054. if (group[4]) split(group[4], Option["tl"], "+")
  5055. continue
  5056. }
  5057. match(ARGV[pos], /^--?(D|debug)$/)
  5058. if (RSTART) {
  5059. Option["debug"] = 1
  5060. continue
  5061. }
  5062. match(ARGV[pos], /^--?no-init/)
  5063. if (RSTART) continue
  5064. match(ARGV[pos], /^-(-?no-op)?$/)
  5065. if (RSTART) continue
  5066. match(ARGV[pos], /^--$/)
  5067. if (RSTART) {
  5068. ++pos
  5069. break
  5070. }
  5071. noargv[noargc++] = ARGV[pos]
  5072. }
  5073. if (Option["interactive"] && !Option["no-rlwrap"])
  5074. rlwrapMe()
  5075. else if (Option["emacs"] && !Option["interactive"] && !Option["no-rlwrap"])
  5076. if (emacsMe())
  5077. Option["interactive"] = 1
  5078. initMisc()
  5079. switch (InfoOnly) {
  5080. case "version":
  5081. print getVersion()
  5082. exit ExitCode
  5083. case "help":
  5084. print getHelp()
  5085. exit ExitCode
  5086. case "manual":
  5087. showMan()
  5088. exit ExitCode
  5089. case "reference":
  5090. print getReference("endonym")
  5091. exit ExitCode
  5092. case "reference-english":
  5093. print getReference("name")
  5094. exit ExitCode
  5095. case "list":
  5096. print getList(Option["tl"])
  5097. exit ExitCode
  5098. case "list-engines":
  5099. for (translator in Translator)
  5100. print (Option["engine"] == translator ? "* " : " ") translator
  5101. exit ExitCode
  5102. case "upgrade":
  5103. upgrade()
  5104. exit ExitCode
  5105. case "nothing":
  5106. exit ExitCode
  5107. }
  5108. setTheme()
  5109. if (Option["interactive"])
  5110. welcome()
  5111. if (pos < ARGC)
  5112. for (i = pos; i < ARGC; i++)
  5113. noargv[noargc++] = ARGV[i]
  5114. if (noargc) {
  5115. for (i = 0; i < noargc; i++) {
  5116. if (Option["verbose"] && i > pos)
  5117. p(prettify("source-seperator", replicate(Option["chr-source-seperator"], Option["width"])))
  5118. translate(noargv[i], 1)
  5119. }
  5120. } else {
  5121. if (!Option["input"]) Option["input"] = STDIN
  5122. }
  5123. if (Option["input"])
  5124. translateMain()
  5125. exit ExitCode
  5126. }
  5127. EOF
  5128. read -r -d '' TRANS_MANPAGE << 'EOF'
  5129. .\" Automatically generated by Pandoc 2.1.1
  5130. .\"
  5131. .TH "TRANS" "1" "2018\-03\-17" "0.9.6.7" ""
  5132. .hy
  5133. .SH NAME
  5134. .PP
  5135. trans \- Command\-line translator using Google Translate, Bing
  5136. Translator, Yandex.Translate, DeepL Translator, etc.
  5137. .SH SYNOPSIS
  5138. .PP
  5139. \f[B]trans\f[] [\f[I]OPTIONS\f[]] [\f[I]SOURCE\f[]]:[\f[I]TARGETS\f[]]
  5140. [\f[I]TEXT\f[]]...
  5141. .SH DESCRIPTION
  5142. .PP
  5143. This tool translates text into any language from the command\-line,
  5144. using a translation engine such as Google Translate, Bing Translator and
  5145. Yandex.Translate.
  5146. .PP
  5147. Each argument which is not a valid option is treated as \f[I]TEXT\f[] to
  5148. be translated.
  5149. .PP
  5150. If neither \f[I]TEXT\f[] nor the input file is specified by
  5151. command\-line arguments, the program will read and translate from
  5152. standard input.
  5153. .SH OPTIONS
  5154. .SS Information options
  5155. .TP
  5156. .B \f[B]\-V\f[], \f[B]\-version\f[]
  5157. Print version and exit.
  5158. .RS
  5159. .RE
  5160. .TP
  5161. .B \f[B]\-H\f[], \f[B]\-help\f[]
  5162. Print help message and exit.
  5163. .RS
  5164. .RE
  5165. .TP
  5166. .B \f[B]\-M\f[], \f[B]\-man\f[]
  5167. Show man page and exit.
  5168. .RS
  5169. .RE
  5170. .TP
  5171. .B \f[B]\-T\f[], \f[B]\-reference\f[]
  5172. Print reference table of all supported languages and codes, and exit.
  5173. Names of languages are displayed in their endonyms (language name in the
  5174. language itself).
  5175. .RS
  5176. .RE
  5177. .TP
  5178. .B \f[B]\-R\f[], \f[B]\-reference\-english\f[]
  5179. Print reference table of all supported languages and codes, and exit.
  5180. Names of languages are displayed in English.
  5181. .RS
  5182. .RE
  5183. .TP
  5184. .B \f[B]\-L\f[] \f[I]CODES\f[], \f[B]\-list\f[] \f[I]CODES\f[]
  5185. Print details of languages and exit.
  5186. When specifying two or more language codes, concatenate them by plus
  5187. sign "+".
  5188. .RS
  5189. .RE
  5190. .TP
  5191. .B \f[B]\-S\f[], \f[B]\-list\-engines\f[]
  5192. List available translation engines and exit.
  5193. .RS
  5194. .RE
  5195. .TP
  5196. .B \f[B]\-U\f[], \f[B]\-upgrade\f[]
  5197. Check for upgrade of this program.
  5198. .RS
  5199. .RE
  5200. .SS Translator options
  5201. .TP
  5202. .B \f[B]\-e\f[] \f[I]ENGINE\f[], \f[B]\-engine\f[] \f[I]ENGINE\f[]
  5203. Specify the translation engine to use.
  5204. (default: google)
  5205. .RS
  5206. .RE
  5207. .SS Display options
  5208. .TP
  5209. .B \f[B]\-verbose\f[]
  5210. Verbose mode.
  5211. .RS
  5212. .PP
  5213. Show the original text and its most relevant translation, then its
  5214. phonetic notation (if any), then its alternative translations (if any)
  5215. or its definition in the dictionary (if it is a word).
  5216. .PP
  5217. This option is unnecessary in most cases since verbose mode is enabled
  5218. by default.
  5219. .RE
  5220. .TP
  5221. .B \f[B]\-b\f[], \f[B]\-brief\f[]
  5222. Brief mode.
  5223. .RS
  5224. .PP
  5225. Show the most relevant translation or its phonetic notation only.
  5226. .RE
  5227. .TP
  5228. .B \f[B]\-d\f[], \f[B]\-dictionary\f[]
  5229. Dictionary mode.
  5230. .RS
  5231. .PP
  5232. Show the definition of the original word in the dictionary.
  5233. .RE
  5234. .TP
  5235. .B \f[B]\-identify\f[]
  5236. Language identification.
  5237. .RS
  5238. .PP
  5239. Show the identified language of the original text.
  5240. .RE
  5241. .TP
  5242. .B \f[B]\-show\-original\f[] \f[I]Y/n\f[]
  5243. Show original text or not.
  5244. (default: yes)
  5245. .RS
  5246. .RE
  5247. .TP
  5248. .B \f[B]\-show\-original\-phonetics\f[] \f[I]Y/n\f[]
  5249. Show phonetic notation of original text or not.
  5250. (default: yes)
  5251. .RS
  5252. .RE
  5253. .TP
  5254. .B \f[B]\-show\-translation\f[] \f[I]Y/n\f[]
  5255. Show translation or not.
  5256. (default: yes)
  5257. .RS
  5258. .RE
  5259. .TP
  5260. .B \f[B]\-show\-translation\-phonetics\f[] \f[I]Y/n\f[]
  5261. Show phonetic notation of translation or not.
  5262. (default: yes)
  5263. .RS
  5264. .RE
  5265. .TP
  5266. .B \f[B]\-show\-prompt\-message\f[] \f[I]Y/n\f[]
  5267. Show prompt message or not.
  5268. (default: yes)
  5269. .RS
  5270. .RE
  5271. .TP
  5272. .B \f[B]\-show\-languages\f[] \f[I]Y/n\f[]
  5273. Show source and target languages or not.
  5274. (default: yes)
  5275. .RS
  5276. .RE
  5277. .TP
  5278. .B \f[B]\-show\-original\-dictionary\f[] \f[I]y/N\f[]
  5279. Show dictionary entry of original text or not.
  5280. (default: no)
  5281. .RS
  5282. .PP
  5283. This option is enabled in dictionary mode.
  5284. .RE
  5285. .TP
  5286. .B \f[B]\-show\-dictionary\f[] \f[I]Y/n\f[]
  5287. Show dictionary entry of translation or not.
  5288. (default: yes)
  5289. .RS
  5290. .RE
  5291. .TP
  5292. .B \f[B]\-show\-alternatives\f[] \f[I]Y/n\f[]
  5293. Show alternative translations or not.
  5294. (default: yes)
  5295. .RS
  5296. .RE
  5297. .TP
  5298. .B \f[B]\-w\f[] \f[I]NUM\f[], \f[B]\-width\f[] \f[I]NUM\f[]
  5299. Specify the screen width for padding.
  5300. .RS
  5301. .PP
  5302. This option overrides the setting of environment variable
  5303. $\f[B]COLUMNS\f[].
  5304. .RE
  5305. .TP
  5306. .B \f[B]\-indent\f[] \f[I]NUM\f[]
  5307. Specify the size of indent (number of spaces).
  5308. (default: 4)
  5309. .RS
  5310. .RE
  5311. .TP
  5312. .B \f[B]\-theme\f[] \f[I]FILENAME\f[]
  5313. Specify the theme to use.
  5314. (default: default)
  5315. .RS
  5316. .RE
  5317. .TP
  5318. .B \f[B]\-no\-theme\f[]
  5319. Do not use any other theme than default.
  5320. .RS
  5321. .RE
  5322. .TP
  5323. .B \f[B]\-no\-ansi\f[]
  5324. Do not use ANSI escape codes.
  5325. .RS
  5326. .RE
  5327. .TP
  5328. .B \f[B]\-no\-autocorrect\f[]
  5329. Do not autocorrect.
  5330. (if defaulted by the translation engine)
  5331. .RS
  5332. .RE
  5333. .TP
  5334. .B \f[B]\-no\-bidi\f[]
  5335. Do not convert bidirectional texts.
  5336. .RS
  5337. .RE
  5338. .TP
  5339. .B \f[B]\-no\-warn\f[]
  5340. Do not write warning messages to stderr.
  5341. .RS
  5342. .RE
  5343. .TP
  5344. .B \f[B]\-dump\f[]
  5345. Print raw API response instead.
  5346. .RS
  5347. .RE
  5348. .SS Audio options
  5349. .TP
  5350. .B \f[B]\-p\f[], \f[B]\-play\f[]
  5351. Listen to the translation.
  5352. .RS
  5353. .PP
  5354. You must have at least one of the supported audio players
  5355. (\f[B]mplayer\f[], \f[B]mpv\f[] or \f[B]mpg123\f[]) installed to stream
  5356. from Google Text\-to\-Speech engine.
  5357. Otherwise, a local speech synthesizer may be used instead (\f[B]say\f[]
  5358. on macOS, \f[B]espeak\f[] on Linux or other platforms).
  5359. .RE
  5360. .TP
  5361. .B \f[B]\-speak\f[]
  5362. Listen to the original text.
  5363. .RS
  5364. .RE
  5365. .TP
  5366. .B \f[B]\-n\f[] \f[I]VOICE\f[], \f[B]\-narrator\f[] \f[I]VOICE\f[]
  5367. Specify the narrator, and listen to the translation.
  5368. .RS
  5369. .PP
  5370. Common values for this option are \f[B]male\f[] and \f[B]female\f[].
  5371. .RE
  5372. .TP
  5373. .B \f[B]\-player\f[] \f[I]PROGRAM\f[]
  5374. Specify the audio player to use, and listen to the translation.
  5375. .RS
  5376. .PP
  5377. Option \f[B]\-play\f[] will try to use \f[B]mplayer\f[], \f[B]mpv\f[] or
  5378. \f[B]mpg123\f[] by default, since these players are known to work for
  5379. streaming URLs.
  5380. Not all command\-line audio players can work this way.
  5381. Use this option only when you have your own preference.
  5382. .PP
  5383. This option overrides the setting of environment variable
  5384. $\f[B]PLAYER\f[].
  5385. .RE
  5386. .TP
  5387. .B \f[B]\-no\-play\f[]
  5388. Do not listen to the translation.
  5389. .RS
  5390. .RE
  5391. .TP
  5392. .B \f[B]\-no\-translate\f[]
  5393. Do not translate anything when using \-speak.
  5394. .RS
  5395. .RE
  5396. .TP
  5397. .B \f[B]\-download\-audio\f[]
  5398. Download the audio to the current directory.
  5399. .RS
  5400. .RE
  5401. .TP
  5402. .B \f[B]\-download\-audio\-as\f[] \f[I]FILENAME\f[]
  5403. Download the audio to the specified file.
  5404. .RS
  5405. .RE
  5406. .SS Terminal paging and browsing options
  5407. .TP
  5408. .B \f[B]\-v\f[], \f[B]\-view\f[]
  5409. View the translation in a terminal pager (\f[B]less\f[], \f[B]more\f[]
  5410. or \f[B]most\f[]).
  5411. .RS
  5412. .RE
  5413. .TP
  5414. .B \f[B]\-pager\f[] \f[I]PROGRAM\f[]
  5415. Specify the terminal pager to use, and view the translation.
  5416. .RS
  5417. .PP
  5418. This option overrides the setting of environment variable
  5419. $\f[B]PAGER\f[].
  5420. .RE
  5421. .TP
  5422. .B \f[B]\-no\-view\f[]
  5423. Do not view the translation in a terminal pager.
  5424. .RS
  5425. .RE
  5426. .TP
  5427. .B \f[B]\-browser\f[] \f[I]PROGRAM\f[]
  5428. Specify the web browser to use.
  5429. .RS
  5430. .PP
  5431. This option overrides the setting of environment variable
  5432. $\f[B]BROWSER\f[].
  5433. .RE
  5434. .SS Networking options
  5435. .TP
  5436. .B \f[B]\-x\f[] \f[I]HOST:PORT\f[], \f[B]\-proxy\f[] \f[I]HOST:PORT\f[]
  5437. Use HTTP proxy on given port.
  5438. .RS
  5439. .PP
  5440. This option overrides the setting of environment variables
  5441. $\f[B]HTTP_PROXY\f[] and $\f[B]http_proxy\f[].
  5442. .RE
  5443. .TP
  5444. .B \f[B]\-u\f[] \f[I]STRING\f[], \f[B]\-user\-agent\f[] \f[I]STRING\f[]
  5445. Specify the User\-Agent to identify as.
  5446. .RS
  5447. .PP
  5448. This option overrides the setting of environment variables
  5449. $\f[B]USER_AGENT\f[].
  5450. .RE
  5451. .SS Interactive shell options
  5452. .TP
  5453. .B \f[B]\-I\f[], \f[B]\-interactive\f[], \f[B]\-shell\f[]
  5454. Start an interactive shell, invoking \f[B]rlwrap\f[] whenever possible
  5455. (unless \f[B]\-no\-rlwrap\f[] is specified).
  5456. .RS
  5457. .RE
  5458. .TP
  5459. .B \f[B]\-E\f[], \f[B]\-emacs\f[]
  5460. Start the GNU Emacs front\-end for an interactive shell.
  5461. .RS
  5462. .PP
  5463. This option does not need to, and cannot be used along with \f[B]\-I\f[]
  5464. or \f[B]\-no\-rlwrap\f[].
  5465. .RE
  5466. .TP
  5467. .B \f[B]\-no\-rlwrap\f[]
  5468. Do not invoke \f[B]rlwrap\f[] when starting an interactive shell.
  5469. .RS
  5470. .PP
  5471. This option is useful when your terminal type is not supported by
  5472. \f[B]rlwrap\f[] (e.g.
  5473. \f[B]emacs\f[]).
  5474. .RE
  5475. .SS I/O options
  5476. .TP
  5477. .B \f[B]\-i\f[] \f[I]FILENAME\f[], \f[B]\-input\f[] \f[I]FILENAME\f[]
  5478. Specify the input file.
  5479. .RS
  5480. .PP
  5481. Source text to be translated will be read from the input file, instead
  5482. of standard input.
  5483. .RE
  5484. .TP
  5485. .B \f[B]\-o\f[] \f[I]FILENAME\f[], \f[B]\-output\f[] \f[I]FILENAME\f[]
  5486. Specify the output file.
  5487. .RS
  5488. .PP
  5489. Translations will be written to the output file, instead of standard
  5490. output.
  5491. .RE
  5492. .SS Language preference options
  5493. .TP
  5494. .B \f[B]\-l\f[] \f[I]CODE\f[], \f[B]\-hl\f[] \f[I]CODE\f[], \f[B]\-lang\f[] \f[I]CODE\f[]
  5495. Specify your home language (the language you would like to see for
  5496. displaying prompt messages in the translation).
  5497. .RS
  5498. .PP
  5499. This option affects only the display in verbose mode (anything other
  5500. than source language and target language will be displayed in your home
  5501. language).
  5502. This option has no effect in brief mode.
  5503. .PP
  5504. This option is optional.
  5505. When its setting is omitted, English will be used.
  5506. .PP
  5507. This option overrides the setting of environment variables
  5508. $\f[B]LANGUAGE\f[], $\f[B]LC_ALL\f[], $\f[B]LANG\f[] and
  5509. $\f[B]HOME_LANG\f[].
  5510. .RE
  5511. .TP
  5512. .B \f[B]\-s\f[] \f[I]CODE\f[], \f[B]\-sl\f[] \f[I]CODE\f[], \f[B]\-source\f[] \f[I]CODE\f[], \f[B]\-from\f[] \f[I]CODE\f[]
  5513. Specify the source language (the language of original text).
  5514. .RS
  5515. .PP
  5516. This option is optional.
  5517. When its setting is omitted, the language of original text will be
  5518. identified automatically (with a possibility of misidentification).
  5519. .PP
  5520. This option overrides the setting of environment variable
  5521. $\f[B]SOURCE_LANG\f[].
  5522. .RE
  5523. .TP
  5524. .B \f[B]\-t\f[] \f[I]CODES\f[], \f[B]\-tl\f[] \f[I]CODE\f[], \f[B]\-target\f[] \f[I]CODES\f[], \f[B]\-to\f[] \f[I]CODES\f[]
  5525. Specify the target language(s) (the language(s) of translated text).
  5526. When specifying two or more language codes, concatenate them by plus
  5527. sign "+".
  5528. .RS
  5529. .PP
  5530. This option is optional.
  5531. When its setting is omitted, everything will be translated into English.
  5532. .PP
  5533. This option overrides the setting of environment variables
  5534. $\f[B]LANGUAGE\f[], $\f[B]LC_ALL\f[], $\f[B]LANG\f[] and
  5535. $\f[B]TARGET_LANG\f[].
  5536. .RE
  5537. .TP
  5538. .B [\f[I]SOURCE\f[]]:[\f[I]TARGETS\f[]]
  5539. A simpler, alternative way to specify the source language and target
  5540. language(s) is to use a shortcut formatted string:
  5541. .RS
  5542. .IP \[bu] 2
  5543. \f[I]SOURCE\-CODE\f[]:\f[I]TARGET\-CODE\f[]
  5544. .IP \[bu] 2
  5545. \f[I]SOURCE\-CODE\f[]:\f[I]TARGET\-CODE1\f[]+\f[I]TARGET\-CODE2\f[]+...
  5546. .IP \[bu] 2
  5547. \f[I]SOURCE\-CODE\f[]=\f[I]TARGET\-CODE\f[]
  5548. .IP \[bu] 2
  5549. \f[I]SOURCE\-CODE\f[]=\f[I]TARGET\-CODE1\f[]+\f[I]TARGET\-CODE2\f[]+...
  5550. .PP
  5551. Delimiter ":" and "=" can be used interchangeably.
  5552. .PP
  5553. Either \f[I]SOURCE\f[] or \f[I]TARGETS\f[] may be omitted, but the
  5554. delimiter character must be kept.
  5555. .RE
  5556. .SS Other options
  5557. .TP
  5558. .B \f[B]\-no\-init\f[]
  5559. Do not load any initialization script.
  5560. .RS
  5561. .RE
  5562. .TP
  5563. .B \f[B]\-\-\f[]
  5564. End\-of\-options.
  5565. .RS
  5566. .PP
  5567. All arguments after this option are treated as \f[I]TEXT\f[] to be
  5568. translated.
  5569. .RE
  5570. .SH EXIT STATUS
  5571. .TP
  5572. .B \f[B]0\f[]
  5573. Successful translation.
  5574. .RS
  5575. .RE
  5576. .TP
  5577. .B \f[B]1\f[]
  5578. Error.
  5579. .RS
  5580. .RE
  5581. .SH ENVIRONMENT
  5582. .TP
  5583. .B \f[B]PAGER\f[]
  5584. Equivalent to option setting \f[B]\-pager\f[].
  5585. .RS
  5586. .RE
  5587. .TP
  5588. .B \f[B]BROWSER\f[]
  5589. Equivalent to option setting \f[B]\-browser\f[].
  5590. .RS
  5591. .RE
  5592. .TP
  5593. .B \f[B]PLAYER\f[]
  5594. Equivalent to option setting \f[B]\-player\f[].
  5595. .RS
  5596. .RE
  5597. .TP
  5598. .B \f[B]HTTP_PROXY\f[]
  5599. Equivalent to option setting \f[B]\-proxy\f[].
  5600. .RS
  5601. .RE
  5602. .TP
  5603. .B \f[B]USER_AGENT\f[]
  5604. Equivalent to option setting \f[B]\-user\-agent\f[].
  5605. .RS
  5606. .RE
  5607. .TP
  5608. .B \f[B]HOME_LANG\f[]
  5609. Equivalent to option setting \f[B]\-lang\f[].
  5610. .RS
  5611. .RE
  5612. .TP
  5613. .B \f[B]SOURCE_LANG\f[]
  5614. Equivalent to option setting \f[B]\-source\f[].
  5615. .RS
  5616. .RE
  5617. .TP
  5618. .B \f[B]TARGET_LANG\f[]
  5619. Equivalent to option setting \f[B]\-target\f[].
  5620. .RS
  5621. .RE
  5622. .SH FILES
  5623. .TP
  5624. .B \f[I]/etc/translate\-shell\f[]
  5625. Initialization script.
  5626. (system\-wide)
  5627. .RS
  5628. .RE
  5629. .TP
  5630. .B \f[I]$HOME/.translate\-shell/init.trans\f[]
  5631. Initialization script.
  5632. (user\-specific)
  5633. .RS
  5634. .RE
  5635. .TP
  5636. .B \f[I]$XDG_CONFIG_HOME/translate\-shell/init.trans\f[]
  5637. Initialization script.
  5638. (user\-specific)
  5639. .RS
  5640. .RE
  5641. .TP
  5642. .B \f[I]./.trans\f[]
  5643. Initialization script.
  5644. (current directory)
  5645. .RS
  5646. .RE
  5647. .SH REPORTING BUGS
  5648. .PP
  5649. <https://github.com/soimort/translate-shell/issues>
  5650. .SH AUTHORS
  5651. Mort Yao <soi@mort.ninja>.
  5652. EOF
  5653. export TRANS_MANPAGE
  5654. export TRANS_BUILD=release
  5655. gawk -f <(echo -E "$TRANS_PROGRAM") - "$@"
Add Comment
Please, Sign In to add comment