mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Translate fix
Fix problem when Googole Transtale replace "" on «» during translation, what broke the syntax
This commit is contained in:
@@ -86,7 +86,11 @@ router.post('/google', jsonParser, async (request, response) => {
|
||||
try {
|
||||
const result = normaliseResponse(JSON.parse(data));
|
||||
console.log('Translated text: ' + result.text);
|
||||
return response.send(result.text);
|
||||
|
||||
// Заменяем кавычки «» на ""
|
||||
const fixedText = result.text.replace(/«/g, '"').replace(/»/g, '"');
|
||||
|
||||
return response.send(fixedText);
|
||||
} catch (error) {
|
||||
console.log('Translation error', error);
|
||||
return response.sendStatus(500);
|
||||
|
Reference in New Issue
Block a user