Hello, I develop a multi-language service and found your library quite helpfull.
But recently I had an interesting issue with yandex API.
And more I use it more I face this problem.
The issue appears suddenly, it doesn't bind with length or complexeety of a json file.
The problem looks like this:
{
"key": "value(.|.)]key2 value2",
"key3": "value3",
"key4": "value4"
}
Steps to reproduce
- We have some json file in eng
{
"mySchemesRoute": "Tariffs",
"distribution": "Distribution",
"allSchemesRoute": "Catalog schemes",
"cityPlaceholder": "City"
}
- We run translate from en to fr and recive
{
"mySchemesRoute": "Les droits de douane(.|.)]La Distribution de",
"distribution": "Catalogue des régimes de",
"allSchemesRoute": "Ville"
}
In example above, we lost the last key/value, and our first value is not exactly what we expect to receive :)
As I understood, you use var hashSimple = '[(.|.)]'
as symbol to join the array value we use, because yandex wants to receive a string, and we use something that user never want to translate, right?.
I dont know why, but after we send, in our example, "Tariffs[(.|.)]Distribution...etc'.
We recieve from yandex Les droits de douane(.|.)]La Distribution de
so they somehow LOST our first "[" symbol, and so your split (var result = res.text[0].split(hashSimple);
) can't do it properly
Solution
As an solution for me, i use var hashSimple = '/|/|/|'
Maybe this should be committed in repo?