ceviri 171 KB

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