I have stored in MySql the following HTML that is used to send an email:
<p>Thank you for signing up to our <a translate="no" href="$WebsiteURL">$WebsiteName - $WebsiteDescription</a></p>
<p>You will find instructions on what options are available for you as soon as you sign into your account.</p>
<p>Your username is $Username</p>
<p translate="no">Regards,</p>
<p translate="no">The xxx Team</p>
The $WebsiteURL, $WebsiteName, $WebsiteDescription and $Username is just replaced when sending the email so this isnt the issue.
The issue is if I paste the above code into the LibreTranslate web UI xxx:5000 it translates ok (for example into Thai):
<p>ขอบคุณที่ลงทะเบียนให้ <a href="$WebsiteURL" translate="no">$WebsiteName - $WebsiteDescription</a></p>
<p>คุณ จะ พบ คํา แนะ นํา ว่า จะ หา ทาง เลือก อะไร ได้ บ้าง เมื่อ คุณ เซ็น ชื่อ ใน บัญชี.</p><p>ชื่อผู้ใช้ของคุณเป็น $ ชื่อผู้ใช้ </p>
<p translate="no">Regards,</p>
<p translate="no">The xxx Team</p>
but when I get this HTML from the DB as a string it has " surrounding any quotation marks.
Example:
<p>Thank you for signing up to our <a translate=\"no\" href=\"$WebsiteURL\">$WebsiteName - $WebsiteDescription</a></p>\n
<p>You will find instructions on what options are available for you as soon as you sign into your account.</p>\n
<p>Your username is $Username</p>\n<p translate=\"no\">Regards,</p>\n
<p translate=\"no\">The xxx Team</p>`
So when I try to translate using the DB string with the " in the string using the following:
var TranslateAsyncTask = oTranslate.TranslateAsync(new Translate()
{
// ApiKey = "MySecretApiKey",
Source = sOriginalLanguageCode.Substring(0, 2),
Target = sTranslatedLanguageCode.Substring(0, 2),
Text = sOriginalText
});
I end up with a completly different translation:
<p> ขอบคุณที่ลงชื่อใน <a ของเรา แปลว่า "ไม่" (REFF=$WebsiteURL") $ website " - $ website
<p> คุณจะพบคําแนะนําเกี่ยวกับตัวเลือกต่าง ๆ ที่จะมีให้คุณทันทีที่คุณเซ็นในบัญชีของคุณ
<p> ชื่อผู้ใช้ของคุณคือ $ ชื่อผู้ใช้
<p = "no"> Recert, [p]
<p = "no"> ทีม AMS
What am I doing wrong?
Regards
J