Add support for app string translations in questionnaire imports, enhance UI strings, and improve question navigation in editor
Some checks failed
PHPUnit / test (push) Has been cancelled
Some checks failed
PHPUnit / test (push) Has been cancelled
This commit is contained in:
20
common.php
20
common.php
@ -2094,6 +2094,26 @@ function qdb_import_questionnaires_bundle(PDO $pdo, array $bundle, bool $replace
|
||||
if (!is_array($items) || !$items) {
|
||||
json_error('MISSING_FIELDS', 'bundle.questionnaires array is required', 400);
|
||||
}
|
||||
foreach ($bundle['appStringTranslations'] ?? [] as $st) {
|
||||
if (!is_array($st)) {
|
||||
continue;
|
||||
}
|
||||
$sk = trim($st['stringKey'] ?? '');
|
||||
if ($sk === '') {
|
||||
continue;
|
||||
}
|
||||
$map = qdb_normalize_bundle_translations($st['translations'] ?? []);
|
||||
if (!$map) {
|
||||
continue;
|
||||
}
|
||||
if (isset($map[QDB_SOURCE_LANGUAGE])) {
|
||||
qdb_set_app_string_german_label($pdo, $sk, $map[QDB_SOURCE_LANGUAGE]);
|
||||
unset($map[QDB_SOURCE_LANGUAGE]);
|
||||
}
|
||||
if ($map) {
|
||||
qdb_apply_translation_map($pdo, 'app_string', $sk, $map);
|
||||
}
|
||||
}
|
||||
$results = [];
|
||||
foreach ($items as $item) {
|
||||
$results[] = qdb_import_questionnaire_bundle($pdo, $item, $replaceIfExists);
|
||||
|
||||
Reference in New Issue
Block a user