From 2f294b9f2bff3e55548f5b80ea3e04cc5da28096 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 6 Oct 2023 15:55:11 +0300 Subject: [PATCH] [chore] Reformat code --- src/translate.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/translate.js b/src/translate.js index a8c27df1e..449989365 100644 --- a/src/translate.js +++ b/src/translate.js @@ -1,8 +1,6 @@ const fetch = require('node-fetch').default; const https = require('https'); const { readSecret, SECRET_KEYS } = require('./secrets'); -const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser'); -const bingTranslateApi = require('bing-translate-api') const DEEPLX_URL_DEFAULT = 'http://127.0.0.1:1188/translate'; const ONERING_URL_DEFAULT = 'http://127.0.0.1:4990/translate'; @@ -60,6 +58,7 @@ function registerEndpoints(app, jsonParser) { }); app.post('/api/translate/google', jsonParser, async (request, response) => { + const { generateRequestUrl, normaliseResponse } = require('google-translate-api-browser'); const text = request.body.text; const lang = request.body.lang; @@ -244,8 +243,10 @@ function registerEndpoints(app, jsonParser) { }); app.post('/api/translate/bing', jsonParser, async (request, response) => { + const bingTranslateApi = require('bing-translate-api'); const text = request.body.text; - let lang = request.body.lang + let lang = request.body.lang; + if (request.body.lang === 'zh-CN') { lang = 'zh-Hans' }