问题
What's wrong with my request?
I have sting in russian:
$string = Потенциал, %
I want to translate it to ukrainian with google API:
I urlencode string:
$q = urlencode($string)
And i request google API:
https://www.googleapis.com/language/translate/v2?q=%D0%9F%D0%BE%D1%82%D0%B5%D0%BD%D1%86%D0%B8%D0%B0%D0%BB%2C%20%25&target=ua&source=ru&key=A...
In response I get :
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value"
}
],
"code": 400,
"message": "Invalid Value"
}
}
What's wrong with my request?
回答1:
Solution was simple. Google has UK letters for ukrainian instead of UA.
回答2:
The target should be uk not ua.I think it will resolve the issue.
来源:https://stackoverflow.com/questions/28570649/invalid-value-400-using-google-translate-api