정민혁

파파고에서 지원하는 모든 언어 번역기능 추가

...@@ -9,6 +9,8 @@ var client_secret = 'Ot0BMdWXOJ'; ...@@ -9,6 +9,8 @@ var client_secret = 'Ot0BMdWXOJ';
9 var api_url = 'https://openapi.naver.com/v1/language/translate'; 9 var api_url = 'https://openapi.naver.com/v1/language/translate';
10 var source = 'ko'; 10 var source = 'ko';
11 var target = 'en'; 11 var target = 'en';
12 +//일본어 ja , 중국어 간체 zh-CN , 중국어 번체 zh-TW
13 +
12 //what kind of task to do 14 //what kind of task to do
13 var translate = false; 15 var translate = false;
14 var dictionary = false; 16 var dictionary = false;
...@@ -31,7 +33,8 @@ app.post('/', function(req, res) { ...@@ -31,7 +33,8 @@ app.post('/', function(req, res) {
31 }, 33 },
32 "keyboard": { 34 "keyboard": {
33 "type": "buttons", 35 "type": "buttons",
34 - "buttons":["한-영", "영-한"] 36 + "buttons":["한-영", "영-한","한-일","일-한","한-중국어간체","중국어간체-한","한-중국어번체",
37 + "중국어번체-한"]
35 } 38 }
36 }); 39 });
37 }else if (_obj.content == '번역'){ 40 }else if (_obj.content == '번역'){
...@@ -148,6 +151,36 @@ app.post('/', function(req, res) { ...@@ -148,6 +151,36 @@ app.post('/', function(req, res) {
148 source = "en"; 151 source = "en";
149 target = "ko"; 152 target = "ko";
150 } 153 }
154 + else if (_obj.content == "한-일")
155 + {
156 + source = "ko";
157 + target = "ja";
158 + }
159 + else if (_obj.content == "일-한")
160 + {
161 + source = "ja";
162 + target = "ko";
163 + }
164 + else if (_obj.content == "한-중국어간체")
165 + {
166 + source = "ko";
167 + target = "zh-CN";
168 + }
169 + else if (_obj.content == "중국어간체-한")
170 + {
171 + source = "zh-CN";
172 + target = "ko";
173 + }
174 + else if (_obj.content == "한-중국어번체")
175 + {
176 + source = "ko";
177 + target = "zh-TW";
178 + }
179 + else if (_obj.content == "중국어번체-한")
180 + {
181 + source = "zh-TW";
182 + target = "ko";
183 + }
151 console.log(source, target); 184 console.log(source, target);
152 res.json({ 185 res.json({
153 "message": { 186 "message": {
......