【问题标题】:Google Translate API - isReliable not returning anythingGoogle Translate API - isReliable 不返回任何内容
【发布时间】:2009-09-06 23:27:16
【问题描述】:

有人曾将 isReliable 与 Google Translate API 一起使用吗?它总是返回“未定义”的值。

google.language.translate('hello','','es',function(result){
    alert(result.isReliable); // prints undefined
    alert(result.translation); // prints "hola"
});

资源: Google Translate API - Result objects

【问题讨论】:

    标签: javascript google-translate google-translation-api


    【解决方案1】:

    isReliable - 一个布尔值,表示是否 检测区间认为语言代码对于 给定文本。

    它仅适用于语言检测(不适用于翻译)。

    你可以看一个例子here

    【讨论】:

    • 你有 isReliable 的例子吗?
    • 是的,只需在我在答案中给出的链接中查看源代码即可。在result 对象填充了正确的数据后,isReliable 将得到它的值。您可以通过使用 FireBug 并在 if (!result.error) { 处设置断点来看到这一点。
    猜你喜欢
    • 2018-07-30
    • 1970-01-01
    • 1970-01-01
    • 2021-07-31
    • 1970-01-01
    • 1970-01-01
    • 2015-10-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多