![]() ![]() ![]() So, by using the replace method in this string, I am able to remove the HTML tags from it, let me give you an example of the helper function I built for this:Įnter fullscreen mode Exit fullscreen mode In other scenarios, the tags should remain to keep the html formatting in the string, but in this particular case, the client only want to display a text version of the text being translated, hence we would proceed to do like so. I am basically obtaining only the text from the string received from Zendesk, since the only thing that matters to me is to have the plain text to add it to the translations container. We could take several ways in order to make the comparison possible, however, there is a simpler way of doing this, an after all, programming is pretty much about that, make things simple, hence I will share with you my approach to this matter. In simple terms, this shouldn't be an issue since it is somehow someway the same thing, however, since we are using the strings to compare it with the previous one to avoid repetitions when populating the translated text container in the UI, this becomes a nightmare since the strings are indeed different when it comes to compare them. Howdy folks! It came to pass that in my current project working with a Translation app, we are sending data from Zendesk platform to our app and then to Deepl Translator API in order to get the English translation from any type of language we receive from Zendesk as a payload to our app.Īs a result, the string received from Zendesk contains html tags in ASCII/Symbol format(example ) and the one we receive back from the Deepl Translator API returns this one with the same html tags, but written sometimes in html format (example < and >).![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |