我正在寻找一些工具来检测javascript字符串的语言。我需要检测发送" Locale"的语言。参数到服务器。是否有一些图书馆在客户端做这件事?
答案 0 :(得分:3)
Google有一个可用于此的API:
例如,您要求:
GET https://www.googleapis.com/language/translate/v2/detect?q=I'm +寻找+ for + some + tool + to + detect + + language + of + + string + for + javascript。& key = {YOUR_API_KEY}
您收到:
200 OK
{
"data": {
"detections": [
[
{
"language": "en",
"isReliable": false,
"confidence": 0.80974126
}
]
]
}
}