ENGLISH:
Sale ID prefix is a required field
FRENCH:
Vente préfixe d'ID est un champ obligatoire
Is there a way to have goog
If you specify format Text
, content inside HTML tags will be translated as well. Assume your input is:
This is a <a href="https://example.com/path">link</a>
then example
and path
will be translated as well, which breaks the link.
To avoid this and fix your problem, stick with format HTML
and unescape the text you received back from google translate. In php you might use html_entity_decode.
If you use google translate client lib, you should pass format_ in translate method, not format, it is format_ below are google translate python api:
According to the Google Translate documentation, you can choose which format you will provide the text which is to be translated (see format
in query parameters). The format defaults to HTML
if not specfied.
You should set this query parameter to text
to indicate that you are sending plain-text as Google will likely return the translated text in the same format as it is received.
So your PHP code could become:
$baseUrl = "https://www.googleapis.com/language/translate/v2";
$params ="?key=$api_key&q=$value&source=en&target=$language_key&format=text";
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $baseUrl + $params );
For anyone working in java, there is a format method in Translate.TranslateOption
So right now you might have something translate call like such:
YourTranslateObject.translate(yourTextToBeTranslated,Translate.TranslateOption.targetLanguage(yourTargetLanguageCode))
all you need to do is add a third parameter:
YourTranslateObject.translate(yourTextToBeTranslated,Translate.TranslateOption.targetLanguage(yourTargetLanguageCode), Translate.TranslateOption.format("text"))
since HTML is default, this will switch it to text.