fix translateTranslationChunks function
This commit is contained in:
@@ -237,10 +237,13 @@ export async function translateHTML(html: string, reverse:boolean, charArg:simpl
|
|||||||
|
|
||||||
|
|
||||||
async function translateTranslationChunks(force:boolean = false, additionalChunkLength = 0){
|
async function translateTranslationChunks(force:boolean = false, additionalChunkLength = 0){
|
||||||
|
if(translationChunks.length === 0 || !needSuperChunkedTranslate()){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const currentChunk = translationChunks[translationChunks.length-1]
|
const currentChunk = translationChunks[translationChunks.length-1]
|
||||||
const text: string = currentChunk.chunks.join('\n■\n')
|
const text: string = currentChunk.chunks.join('\n■\n')
|
||||||
|
|
||||||
console.log(text)
|
|
||||||
if(!force && text.length + additionalChunkLength < 5000){
|
if(!force && text.length + additionalChunkLength < 5000){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -250,6 +253,10 @@ export async function translateHTML(html: string, reverse:boolean, charArg:simpl
|
|||||||
resolvers: []
|
resolvers: []
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if(!text){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const translated = await translate(text, reverse)
|
const translated = await translate(text, reverse)
|
||||||
|
|
||||||
const split = translated.split('■')
|
const split = translated.split('■')
|
||||||
|
|||||||
Reference in New Issue
Block a user