mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
[chore] Apply lint and formatter
This commit is contained in:
@ -410,13 +410,13 @@ async function translate(text, lang) {
|
|||||||
const chunks = text.split(/!\[.*?]\([^)]*\)/);
|
const chunks = text.split(/!\[.*?]\([^)]*\)/);
|
||||||
const links = [...text.matchAll(/!\[.*?]\([^)]*\)/g)];
|
const links = [...text.matchAll(/!\[.*?]\([^)]*\)/g)];
|
||||||
|
|
||||||
let r = "";
|
let result = '';
|
||||||
for (let i = 0; i < chunks.length; i++) {
|
for (let i = 0; i < chunks.length; i++) {
|
||||||
r += await translateInner(chunks[i], lang);
|
result += await translateInner(chunks[i], lang);
|
||||||
if (i < links.length) r += links[i][0];
|
if (i < links.length) result += links[i][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return result;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
toastr.error(String(error), 'Failed to translate message');
|
toastr.error(String(error), 'Failed to translate message');
|
||||||
|
Reference in New Issue
Block a user