Powerful and easy to use cms to build websites, blogs or ecommerce stores.
HTML backendblogblog-engineblog-platformbloggingcmscontent-managementcontent-management-systemecommerceecommerce-platformno-codepage-builderphpphp-cmsphp7php8self-hostedshopping-cartweb-applicationwebsite-builder
Fixed page builder translation saving issues
givanz0e7cc57fa182
diff --git a/admin/controller/editor/translate.php b/admin/controller/editor/translate.phpindex 9bbab60..bb24b20 100644--- a/admin/controller/editor/translate.php+++ b/admin/controller/editor/translate.php@@ -30,14 +30,18 @@ class Translate extends Base {$text = $this->request->post['text'];$languages = \Vvveb\availableLanguages();$translations = [];+ $defaultLang = \Vvveb\getLanguage();foreach ($languages as $lang) {$code = $lang['code'];\Vvveb\setLanguage($code);- $translations[$code] = __($text);+ \Vvveb\setLanguageCode($code);++ $translations[$code] = __($text, false, false, true);}//restore language- \Vvveb\setLanguage(\Vvveb\getLanguage());+ \Vvveb\setLanguage($defaultLang);+ \Vvveb\setLanguageCode($defaultLang);$this->response->setType('json');$this->response->output($translations);@@ -50,6 +54,7 @@ class Translate extends Base {if ($translations) {require_once DIR_SYSTEM . 'functions' . DS . 'php-mo.php';+ unset($translations['csrf']);$defaultLang = key($translations); //'en_US';$domain = 'vvveb';@@ -94,8 +99,17 @@ class Translate extends Base {$success = false;}}++ if ($success) {+ $cacheFile = DIR_CACHE . $langCode . '-translations.php';+ if (file_exists($cacheFile)) {+ @unlink($cacheFile);+ }+ }}++$this->response->setType('json');$this->response->output(['success' => $success, 'message' => $message]);}diff --git a/admin/controller/localization/translations.php b/admin/controller/localization/translations.phpindex 4e0117a..b378c14 100755--- a/admin/controller/localization/translations.php+++ b/admin/controller/localization/translations.php@@ -103,6 +103,9 @@ class Translations extends Base {$this->domain();$folder = DIR_ROOT . 'locale' . DS . $view->lang . DS . 'LC_MESSAGES' . DS;+ if (! file_exists($folder)) {+ mkdir($folder, 0777, true);+ }foreach ($translations as $text => $translation) {$view->translations[$text] = ['msgid' => $text, 'msgstr' => [$translation]];