From f6f4de095cdda150ac681e4cd7740abef357b74e Mon Sep 17 00:00:00 2001 From: chromos33 Date: Mon, 25 Nov 2024 17:02:09 +0100 Subject: [PATCH] Update TranslateDataObjectExtension.php --- src/Extensions/TranslateDataObjectExtension.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Extensions/TranslateDataObjectExtension.php b/src/Extensions/TranslateDataObjectExtension.php index 53b5d94..e0830be 100644 --- a/src/Extensions/TranslateDataObjectExtension.php +++ b/src/Extensions/TranslateDataObjectExtension.php @@ -38,8 +38,9 @@ public function onBeforeWrite() if (array_key_exists("Translate", $this->owner->getChangedFields(false, 1))) { if ($this->owner->getChangedFields(false, 1)["Translate"]["after"] == 1) { $sourcelocale = $this->owner->getChangedFields(false, 1)["OriginalLanguage"]["after"]; - $tmp = explode('_', Locale::getCurrentLocale()->Locale); - $targetlocale = strtoupper($tmp[0]); + $targetlocale = str_replace("_","-",Locale::getCurrentLocale()->Locale); + + $targetlocale = strtoupper($targetlocale); $localisedFields = []; $includedTables = []; $baseClass = $this->owner->baseClass();