Skip to content
Snippets Groups Projects
Commit 4d62dac9 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

don't store translations of I18NString if they are equal to the original base string, fixes #4863

Closes #4863

Merge request studip/studip!3646
parent fb156f20
No related branches found
No related tags found
No related merge requests found
......@@ -269,10 +269,11 @@ class I18NString implements JsonSerializable
throw new RuntimeException('store not possible, metadata is missing');
}
/* Replace translations */
$deleted = $db->execute("DELETE FROM i18n WHERE object_id = ? AND `table` = ? AND field = ?", [$object_id, $table, $field]);
$db->execute("DELETE FROM i18n WHERE object_id = ? AND `table` = ? AND field = ?", [$object_id, $table, $field]);
$i18nSQL = $db->prepare("INSERT INTO `i18n` (`object_id`, `table`, `field`, `lang`, `value`) VALUES (?,?,?,?,?)");
foreach ($this->lang as $lang => $value) {
if (mb_strlen($value)) {
if (mb_strlen($value) && $value !== $this->base) {
$i18nSQL->execute([$object_id, $table, $field, $lang, (string) $value]);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment