M
M
mrSaizer2021-04-13 16:28:04
Machine translation from one language to another
mrSaizer, 2021-04-13 16:28:04

How to translate texts that are in html format (with tags)?

There is text in html format with tags, markup, and so on.
It needs to be translated into another language so that all these tags are preserved.

For example, it is "<table>Hi"necessary to translate as "<table>Привет", and not "<Таблица>Привет"(or else, for some reason, if translators leave the tags correct, then they will definitely bump extra spaces there, which is also not ok).

In general, the question is - with the help of which it will be possible to carry out such transfers?

I found the perfect option for myself according to the description https://packagecontrol.io/packages/YandexTranslate (sublim + this add-on, but for some reason it doesn’t work for me ..)

PS 99% of translations from English to Polish. Algorithm / Translation service is suitable for anyone, except for Google translator.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-04-14
@Aleksandr-JS-Developer

Of course, maybe it will be more voluminous in terms of work, but it will work well.
Create a file with all texts. Let's say in English. When initializing the page, insert the necessary texts into the required fields.
Next, the user clicks the transfer button.
There's magic here. You send the necessary texts to the translators api. You receive answers, you draw them on the page.
Although Google Translate is not suitable for you, they have an excellent API description, which is not much different from similar services.
One of the advantages of this approach is saving traffic + saving characters when translating, and this, looking back at not free services, is very good.
If 99% of translations are from English to Polish, then you can save a ready-made, valid, Polish translation into a file with translations. All the rest - through the API.

const translations = {
  eng: {...},
  pl: {...}
}

By the way, the same Google translator can also translate HTML pages of the
Docks using Google Translate API

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question