View Issue Details

This bug affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
19441Bug reportsTranslationpublic2024-02-26 09:13
ReporterMazi Assigned Toc_schmitz  
PrioritynoneSeveritycrash 
Status feedbackResolutionopen 
Product Version6.4.x 
Summary19441: Google translate feature broken at 3.x and 6.x (and probably 5.x?)
Description

We tried testing the Google translate feature at the quick translation screen. For this we have added a Google translate API key at the global settings. Afterwards, the button to auto-translate show up at the quick translation screen.

When clicking that button I get "There was an error using the Google API. Detailed error: true.
Since that doesn't tell you much, I enabled debug mode and it turns out that the Ajax request to the API throws a 500m server error. This is the 3.x (latest version) error stack:
<h1>PHP Error [500]</h1>

file_get_contents(https://www.googleapis.com/language/translate/v2?q=%0A%3Cdiv+class%3D%22question-text-from%22%3E%3C%2Fdiv%3E%0A &source=de &target=en &key=XXXXRG4yBSnOF1q22Hw2iazgtjBRr9Hinc &): Failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden
(/var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/application/third_party/gtranslate-api/GTranslate.php:272)


#0 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/base/CErrorHandler.php(133): CErrorHandler->handleError()
#1 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/base/CApplication.php(832): CErrorHandler->handle()
#2 unknown(0): LSYii_Application->handleError()
#3 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/application/third_party/gtranslate-api/GTranslate.php(272): file_get_contents()
#4 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/application/third_party/gtranslate-api/GTranslate.php(258): GTranslate->requestHttp()
#5 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/application/third_party/gtranslate-api/GTranslate.php(377): GTranslate->query()
#6 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/application/controllers/admin/translate.php(1021): GTranslate->__call()
#7 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/application/controllers/admin/translate.php(986): translate->translate_google_api()
#8 unknown(0): translate->ajaxtranslategoogleapi()
#9 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/web/actions/CAction.php(115): ReflectionMethod->invokeArgs()
#10 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/application/core/Survey_Common_Action.php(83): translate->runWithParamsInternal()
#11 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/web/CController.php(308): translate->runWithParams()
#12 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/web/CController.php(286): AdminController->runAction()
#13 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/web/CController.php(265): AdminController->runActionWithFilters()
#14 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/application/controllers/AdminController.php(165): AdminController->run()
#15 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/web/CWebApplication.php(282): AdminController->run()
#16 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/web/CWebApplication.php(141): LSYii_Application->runController()
#17 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/framework/base/CApplication.php(185): LSYii_Application->processRequest()
#18 /var/www/vhosts/my-domain.com/httpdocs/ls3dev.my-domain.com/ls/index.php(195): LSYii_Application->run()

We tested the same with the 6.x version and get this error using debug mode:
<h1>PHP Error [500]</h1>

Undefined property: stdClass::$data (/var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/gtranslate-api/GTranslate.php:318)


#0 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/base/CErrorHandler.php(133): CErrorHandler->handleError()
#1 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/base/CApplication.php(832): CErrorHandler->handle()
#2 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/gtranslate-api/GTranslate.php(318): LSYii_Application->handleError()
#3 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/gtranslate-api/GTranslate.php(299): GTranslate->evalResponse()
#4 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/gtranslate-api/GTranslate.php(262): GTranslate->requestCurl()
#5 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/gtranslate-api/GTranslate.php(381): GTranslate->query()
#6 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/application/controllers/QuickTranslationController.php(469): GTranslate->__call()
#7 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/application/controllers/QuickTranslationController.php(428): QuickTranslationController->translateGoogleApi()
#8 unknown(0): QuickTranslationController->actionAjaxtranslategoogleapi()
#9 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/web/actions/CAction.php(114): ReflectionMethod->invokeArgs()
#10 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/web/actions/CInlineAction.php(47): CInlineAction->runWithParamsInternal()
#11 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/web/CController.php(308): CInlineAction->runWithParams()
#12 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/web/CController.php(286): QuickTranslationController->runAction()
#13 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/web/CController.php(265): QuickTranslationController->runActionWithFilters()
#14 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/application/controllers/LSBaseController.php(145): QuickTranslationController->run()
#15 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/web/CWebApplication.php(282): QuickTranslationController->run()
#16 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/web/CWebApplication.php(141): LSYii_Application->runController()
#17 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/vendor/yiisoft/yii/framework/base/CApplication.php(185): LSYii_Application->processRequest()
#18 /var/www/vhosts/my-domain.com/httpdocs/ls6dev.my-domain.com/index.php(161): LSYii_Application->run()

Steps To Reproduce

Steps to reproduce

Enter a valid Google translate API key. Use quick translation to translate details at a multilingual survey and click "Auto Translate" there.

Expected result

Texts should get translated

Actual result

Error, see above

TagsNo tags attached.
Bug heat4
Complete LimeSurvey version number (& build)6.4.5
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMariaDB 10.1.48
Server OS (if known)
Webserver software & version (if known)
PHP Version8.2

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2024-02-23 21:23

updater   ~79616

@DenisChenu, do you have an API key at hand to test if you can reproduce this?

c_schmitz

c_schmitz

2024-02-24 09:39

administrator   ~79617

Update to the latest version. There has been a recent fix.

Mazi

Mazi

2024-02-26 09:07

updater   ~79618

@c_schmitz, thanks a lot for the hint. I updated to 6.4.8+240221 but still get error "There was an error using the Google API. Detailed error: true." when clicking the auto translate button.

c_schmitz

c_schmitz

2024-02-26 09:08

administrator   ~79619

Check your Google API console if you can see any errors/calls there.

Issue History

Date Modified Username Field Change
2024-02-23 21:22 Mazi New Issue
2024-02-23 21:23 Mazi Note Added: 79616
2024-02-23 21:23 Mazi Bug heat 0 => 2
2024-02-24 09:39 c_schmitz Assigned To => c_schmitz
2024-02-24 09:39 c_schmitz Status new => feedback
2024-02-24 09:39 c_schmitz Note Added: 79617
2024-02-24 09:39 c_schmitz Bug heat 2 => 4
2024-02-26 09:07 Mazi Note Added: 79618
2024-02-26 09:07 Mazi Status feedback => assigned
2024-02-26 09:08 c_schmitz Note Added: 79619
2024-02-26 09:13 c_schmitz Status assigned => feedback