Rapid Translate Multi Traduction

免费增值
通过 oussama sibari | 已更新 7 days ago | Text Analysis
人气

9.8 / 10

延迟

380ms

服务等级

100%

Health Check

N/A

返回所有讨论

Wtf result?

Rapid account: Pixiko
pixiko
a year ago

raw curl post
{
“from”: “en”,
“to”: “pt”,
“e”: “”,
“q”: [
“Combine video online | Make own video from any parts”
]
}

result
[
"<i>Combine video online |</i> <b>Combinar vídeo online |</b> <i>Make own video from any parts</i> <b>Faça o próprio vídeo de qualquer parte</b>"
]

WTF?
Where did html tags come from? Where does the original string come from?

Rapid account: Sibaridev
sibaridev Commented a year ago

Dear valued client,

We are excited to inform you that we have added a new endpoint Rapid Translate Long Text to our Fast Translator API service that allows you to translate very long texts and especially without HTML tags ( no <i>, no <b> ). Based on your recommendation, we have added this feature to help you translate large amounts of text more easily and accurately.

With this new endpoint, you can now translate very long texts up to +100 000 characters without worrying about any HTML tags interfering with the translation process. We understand how important it is for you to have a smooth and seamless translation experience, and we are confident that this new feature will meet your needs.

We appreciate your feedback and always strive to improve our service to meet your expectations. If you have any questions or feedback regarding this new feature or any other aspect of our service, please do not hesitate to contact us. We are always here to help you.

Thank you for choosing the Fast Translator API service.

Best regards,

Sibari Oussama

Rapid account: Deleted
[deleted] Commented a year ago

FYI I created a filter function for this which is required to use this api

const hasBIRegex = new RegExp(’</?(?:b|i)(?😦?: [^<>]*)>|>?)’, ‘i’)
const hasHtml = (text) => typeof text === ‘string’ && text.match(hasBIRegex) !== null

const isIRegex = new RegExp(/<i.?></i>/, ‘gi’)
// this endpoint sends back original in italics and output in bold for some reason, as a result we fix it by removing italics text and removing bold tags
const rapidApiOneFormatting = (text) => {
if (hasHtml(text)) {
let txt = text

// an extra space is added between italic closing and new bold for no reason, remove it
txt = txt.replace(/<\/i>\s+<b>/g, '</i><b>')
const removeMatches = text.match(isIRegex)
removeMatches.forEach((match) => {
  // removing matching strings
  txt = txt.replace(match, '')
})

// remove b and i html tags
txt = txt.replace(/<\/?[bi]>/g, '')

return txt

} else {
return text
}
}

the funny thing is, rapid api, an API PLATFORM doesn’t support code in comments, so the above looks a little off in the regex parts

加入讨论 - 在下面添加评论:

登录/注册以发布新的评论