【问题标题】:GTranslate for Joomla showing 400 error and stop workingJoomla 的 GTranslate 显示 400 错误并停止工作
【发布时间】:2021-10-29 03:03:54
【问题描述】:

我在我的 Joomla 网站中使用 GTranslate for Joomla。它工作正常。昨天我观察到它停止工作,并在控制台中显示 400 错误(加载资源失败:服务器响应状态为 400 ())。

我在控制台找到了,

"https://translate.googleapis.com/translate_a/l?[object Map Iterator]=[object Map Iterator]"

Joomla 版本是 3.10.1,GTranlator 版本是 3.7.6

【问题讨论】:

标签: joomla google-translate


【解决方案1】:

问题出在这个文件“media/system/js/mootools-core.js”中。 具体在这部分代码中:

Array.from = function(a) {
return null == a ? [] : f.isEnumerable(a) && "string" != typeof a ? "array" == b(a) ? a : e.call(a) : [a]
}

替换为:

old_array_from = Array.from;
Array.from=function(a){
    return null==a
        ?[]
        :f.isEnumerable(a)&&"string"!=typeof a
            ?"array"==b(a)
                ?a
                :e.call(a)
            :("object" == b(a))
                ?old_array_from(a)
                :[a];
};

解释:

Mootools 1.4.5 版覆盖了原生的“from”数组方法。这会导致与使用 Array.from() 将对象作为参数传递的人发生冲突。

最近 Google 的 API 开始使用 Array.from 将对象作为参数传递。请注意,Google Api 在这部分查询字符串形式中没有得到预期的结果:“?[object Map Iterator]=[object Map Iterator]”。查询字符串的形成应该类似于 '...supportedLanguages?client=te&display_language=pt-BR&key=AIzaSyBwiZMn...'

上面传递的hack在传递一个对象作为参数时使用了javascript的原生Array.from

【讨论】:

    【解决方案2】:

    对此有很多讨论。有些人指责 Joomla 3.10。我一直在与 Gtranslate 联系,然后他们说转到付费版本。我已经与他们升级以找到解决方案,现在已经追求了 6 周。 Mootools / Jaquery 是我理解的问题。

    【讨论】:

    • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
    • 这个答案并不清楚。亚伯拉罕说要升级到 Gtranslate 的付费版本。
    猜你喜欢
    • 1970-01-01
    • 2022-11-19
    • 2018-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多