Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b38555c

Browse filesBrowse files
committed
fix(form_language): filter out obsolete translations
1 parent 35315ca commit b38555c
Copy full SHA for b38555c

2 files changed

+10-1Lines changed: 10 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎inc/form_language.class.php‎

Copy file name to clipboardExpand all lines: inc/form_language.class.php
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,18 @@ public function showTranslations($options = []) {
356356
echo $header;
357357
echo '</thead>';
358358

359+
$all_translated_strings = $form->getTranslatableStrings([
360+
'translated' => true,
361+
'language' => $this->fields['name']
362+
]);
363+
359364
echo '<tbody>';
360365
foreach ($translations as $original => $translated) {
361366
$id = PluginFormcreatorTranslation::getTranslatableStringId($original);
367+
if (!in_array($id, array_keys($all_translated_strings['id']))) {
368+
// String is translated but no longer used in the form or its sub objects
369+
continue;
370+
}
362371
echo '<tr data-itemtype="PluginFormcreatorTranslation" data-id="' . $id . '">';
363372
echo '<td>'
364373
. Html::getCheckbox([
Collapse file

‎inc/translation.class.php‎

Copy file name to clipboardExpand all lines: inc/translation.class.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static function getEditorFieldsHtml(PluginFormcreatorForm_Language $formL
161161
if (!isset($translatableString['id'][$id])) {
162162
// Show nothing if string definitively not found
163163
// Should not happen
164-
return '';
164+
return '<td colspan="2">' . __('Iternal error : translatable string not found.', 'formcreator') . '</td>';;
165165
}
166166

167167
$type = $translatableString['id'][$id] ?? 'string';

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.