diff --git a/src/QUI/ERP/Shipping/Types/Factory.php b/src/QUI/ERP/Shipping/Types/Factory.php index 4f61761b44fb93dc0baac6fbd5c818c069d4aa69..174b9fc00ef8ef0c82c4732459650e941d578cca 100644 --- a/src/QUI/ERP/Shipping/Types/Factory.php +++ b/src/QUI/ERP/Shipping/Types/Factory.php @@ -67,16 +67,17 @@ public function createChild($data = []) $NewChild = parent::createChild($data); $this->createShippingLocale( - 'shipping.'.$NewChild->getId().'.title', + 'shipping.' . $NewChild->getId() . '.title', $NewChild->getShippingType()->getTitle() ); $this->createShippingLocale( - 'shipping.'.$NewChild->getId().'.workingTitle', - $NewChild->getShippingType()->getTitle().' - '.$NewChild->getId() + 'shipping.' . $NewChild->getId() . '.workingTitle', + $NewChild->getShippingType()->getTitle() . ' - ' . $NewChild->getId() ); - $this->createShippingLocale('shipping.'.$NewChild->getId().'.decription', ''); + // description + $this->createShippingLocale('shipping.' . $NewChild->getId() . '.description', ' '); try { QUI\Translator::publish('quiqqer/shipping'); @@ -148,19 +149,22 @@ public function getChild($id) */ protected function createShippingLocale($var, $title) { - $current = QUI::getLocale()->getCurrent(); - if (QUI::getLocale()->isLocaleString($title)) { $parts = QUI::getLocale()->getPartsOfLocaleString($title); $title = QUI::getLocale()->get($parts[0], $parts[1]); } + $data = []; + + foreach (QUI::availableLanguages() as $language) { + $data[$language] = $title; + $data[$language . '_edit'] = $title; + } + + try { - QUI\Translator::addUserVar('quiqqer/shipping', $var, [ - $current => $title, - 'datatype' => 'php,js', - 'package' => 'quiqqer/shipping' - ]); + QUI\Translator::add('quiqqer/shipping', $var, 'quiqqer/shipping', 'php,js'); + QUI\Translator::update('quiqqer/shipping', $var, 'quiqqer/shipping', $data); } catch (QUI\Exception $Exception) { QUI\System\Log::addNotice($Exception->getMessage()); }