View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
20323Bug reportsTranslationpublic2025-10-25 15:40
ReporterMazi Assigned Togabrieljenik  
PrioritynoneSeverityblock 
Status assignedResolutionopen 
Product Version6.6.x 
Summary20323: Google Translate integration fails for some languages due to mismatched language codes (hat, prs, mya, swh, fil)
Description

When using the Quick Translation feature with a configured Google Translate API key, some translations fail because LimeSurvey uses ISO 639‑2 or 639‑3 language codes that are not recognized by the Google Translate API, which only supports ISO 639‑1 codes.
This mismatch occurs because the language identifiers defined in surveytranslator_helper.php (https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/surveytranslator_helper.php)
differ from the official Google Translate language codes (https://cloud.google.com/translate/docs/languages?utm_source=chatgpt.com&hl=en).

Language LimeSurvey Code Google Translate Code Status
Haitian Creole hat ht Mismatch
Dari prs (none – use fa) Mismatch
Filipino fil tl Mismatch
Burmese (Myanmar) mya my Mismatch
Swahili swh sw Mismatch

...but there may be more languages with different codes used.

Steps To Reproduce

Steps to reproduce

You need a valid API key, then you can send a simply CURL request for testing:
curl "https://translation.googleapis.com/language/translate/v2?key=<enter key here>&q=survey&source=en&target=<enter language code>"

Expected result

API call should return the translation of "survey" in the target language defined.

Actual result

API returns this for an invalid/valid target language code:

Wrong code "hat":
curl "https://translation.googleapis.com/language/translate/v2?key=<enter key here>&q=survey&source=en&target=hat"
{
"error": {
"code": 400,
"message": "Invalid Value",
"errors": [
{
"message": "Invalid Value",
"domain": "global",
"reason": "invalid"
}
],
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "target",
"description": "Target language: hat"
}
]
}
]
}
}

Correct code "ht":
curl "https://translation.googleapis.com/language/translate/v2?key=<enter key here>&q=survey&source=en&target=ht"
{
"data": {
"translations": [
{
"translatedText": "sondaj"
}
]
}
}

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)6.15.16
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL/MariaDB
Server OS (if known)
Webserver software & version (if known)
PHP Version8.x

Relationships

related to 20294 assignedgabrieljenik Translation fails (Dari and Tigrinya) due to missing language code mappings 

Users monitoring this issue

There are no users monitoring this issue.

Activities

Mazi

Mazi

2025-10-25 15:40

updater   ~83672

Last edited: 2025-10-25 15:40

Further languages with different codes for Google translate/Limesurvey:

Language LimeSurvey Code Google Translate Code
Chinese (Simplified) zh-Hans zh
Chinese (Traditional - Taiwan) zh-Hant-TW zh-TW
Chinese (Traditional - HK) zh-Hant-HK zh-TW

Issue History

Date Modified Username Field Change
2025-10-25 15:28 Mazi New Issue
2025-10-25 15:32 Mazi Relationship added related to 20294
2025-10-25 15:32 Mazi Assigned To => gabrieljenik
2025-10-25 15:32 Mazi Status new => assigned
2025-10-25 15:32 Mazi Description Updated
2025-10-25 15:40 Mazi Note Added: 83672
2025-10-25 15:40 Mazi Bug heat 0 => 2
2025-10-25 15:40 Mazi Note Edited: 83672