├── bin └── translater.js ├── .gitignore ├── index.js ├── package.json ├── LICENSE └── README.md /bin/translater.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('../'); 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | .idea -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var request = require('request'); 2 | var colors = require('colors'); 3 | var argv = require('yargs').argv; 4 | 5 | 6 | if (argv._.length > 2) { 7 | request('http://mymemory.translated.net/api/get?q=' + argv._[0] + '&langpair=' + argv._[1] + '|' + argv._[2], function (error, response, body) { 8 | 9 | if (response.statusCode === 200) { 10 | 11 | var data = JSON.parse(body.trim()); 12 | 13 | data.matches.forEach(function (val, index, theArray) { 14 | 15 | console.log(colors.green(val.translation)); 16 | 17 | }); 18 | }else{ 19 | console.error(colors.red('translating error !')); 20 | 21 | } 22 | 23 | 24 | }); 25 | } else { 26 | 27 | console.error(colors.red('missing parameters')); 28 | } 29 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "translater", 3 | "version": "2.0.0", 4 | "description": "Translate is a command-line interface to the MyMemory translated", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "bin": { 10 | "translater": "./bin/translater.js" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "https://https://github.com/previousdeveloper/translater.git" 15 | }, 16 | "keywords": [ 17 | "translater" 18 | ], 19 | "author": "Gokhan Karadas (http://www.gokhankaradas.com)", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/previousdeveloper/translater/issues" 23 | }, 24 | "homepage": "https://github.com/previousdeveloper/translater/issues#readme", 25 | "dependencies": { 26 | "colors": "^1.1.2", 27 | "request": "^2.64.0", 28 | "yargs":"^3.29.0" 29 | } 30 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 gökhan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Translater 2 | ============== 3 | 4 | Translate is a command-line interface to the MyMemory translated. 5 | 6 | ![example](http://i66.tinypic.com/2j3pu21.png) 7 | 8 | ## Install 9 | 10 | ### Globally 11 | 12 | ```bash 13 | npm install translater -g 14 | ``` 15 | 16 | ### Locally 17 | 18 | ```bash 19 | npm install translater --save 20 | ``` 21 | 22 | ## Usage 23 | 24 | ```bash 25 | translater <'word'> 26 | ``` 27 | 28 | ## Example 29 | 30 | ```bash 31 | translater 'Hello' en tr 32 | ``` 33 | 34 | ```bash 35 | translater 'Merhaba' tr en 36 | ``` 37 | 38 | ## List of supported languages 39 | 40 | | Language | Are 41 | | ------------- |:-------------:| 42 | |Albanian |sq 43 | |English |en 44 | |Arabic |ar 45 | |Armenian |hy 46 | |Azerbaijan |az 47 | |Afrikaans |af 48 | |Basque |eu 49 | |Belarusian |be 50 | |Bulgarian |bg 51 | |Bosnian |bs 52 | |Welsh |cy 53 | |Vietnamese |vi 54 | |Hungarian |hu 55 | |Haitian (Creole) |ht 56 | |Galician |gl 57 | |Dutch |nl 58 | |Greek |el 59 | |Georgian |ka 60 | |Danish |da 61 | |Yiddish |he 62 | |Indonesian |id 63 | |Irish |ga 64 | |Italian |it 65 | |Icelandic |is 66 | |Spanish |es 67 | |Kazakh |kk 68 | |Catalan |ca 69 | |Kyrgyz |ky 70 | |Chinese |zh 71 | |Korean |ko 72 | |Latin |la 73 | |Latvian |lv 74 | |Lithuanian |lt 75 | |Malagasy |mg 76 | |Malay |ms 77 | |Maltese |mt 78 | |Macedonian |mk 79 | |Mongolian |mn 80 | |German |de 81 | |Norwegian |no 82 | |Persian |fa 83 | |Polish |pl 84 | |Portuguese |pt 85 | |Romanian |ro 86 | |Russian |ru 87 | |Serbian |sr 88 | |Slovakian |sk 89 | |Slovenian |sl 90 | |Swahili |sw 91 | |Tajik |tg 92 | |Thai |th 93 | |Tagalog |tl 94 | |Tatar |tt 95 | |Turkish |tr 96 | |Uzbek |uz 97 | |Ukrainian |uk 98 | |Finish |fi 99 | |French |fr 100 | |Croatian |hr 101 | |Czech |cs 102 | Swedish |sv 103 | Estonian |et 104 | Japanese |ja 105 | 106 | --------------------------------------------------------------------------------