S
S
Stanislav2019-10-26 11:03:15
JavaScript
Stanislav, 2019-10-26 11:03:15

How not to translate names, brands, city names using Yandex api?

Can anyone tell me how to make sure that Yandex does not translate, for example, names into text, so that it does not touch words starting with a capital letter?
So far, only one thing comes to my mind, cut out these words and replace them with some kind of identifier, and after the translation, replace the identifiers with words.

let e = "Name slovo slovo Name2 slovo slovo"
// Как то пересобрать текст чтобы получить следующее
let o = {
    text: "{0} slovo slovo {1} slovo slovo"
    ids: ["Name", "Name2"]
}
// Произвести перевод, а после заменить {0}, {1} на нужные слова

Maybe there are more interesting ideas?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
grinat, 2019-10-27
@grinat

Refuse Yandex, they have a very stupid and miserable translator.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question