diff --git a/.craftplugin b/.craftplugin index 9c0e0f56..f4c73486 100644 --- a/.craftplugin +++ b/.craftplugin @@ -1,7 +1,7 @@ { "pluginName": "Translations for Craft", "pluginDescription": "Drive global growth with simplified translation workflows.", - "pluginVersion": "2.0.3", + "pluginVersion": "2.0.4", "pluginAuthorName": "Acclaro", "pluginVendorName": "Acclaro", "pluginAuthorUrl": "http://www.acclaro.com/", diff --git a/CHANGELOG.md b/CHANGELOG.md index cd947522..edfeb2d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 2.0.4 - 2021-11-12 + +### Fixed +- 'Array to String Conversion' error (https://github.com/AcclaroInc/craft-translations/issues/255) +- 'Variable `webUrls` doesn't exist' error (https://github.com/AcclaroInc/craft-translations/issues/256) + ## 2.0.3 - 2021-10-28 ### Fixed diff --git a/src/Constants.php b/src/Constants.php index a30b1405..1d75466a 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -4,6 +4,7 @@ class Constants { + const PLUGIN_SCHEMA_VERSION = '1.3.6'; const CRAFT_MIN_VERSION = '3.7.9'; const WORD_COUNT_LIMIT = 2000; diff --git a/src/Translations.php b/src/Translations.php index 6198abfd..cd1829fd 100644 --- a/src/Translations.php +++ b/src/Translations.php @@ -29,6 +29,7 @@ use craft\events\RegisterUrlRulesEvent; use craft\events\RegisterComponentTypesEvent; use craft\events\DeleteElementEvent; +use acclaro\translations\Constants; use acclaro\translations\services\App; use acclaro\translations\elements\Order; use acclaro\translations\base\PluginTrait; @@ -73,7 +74,7 @@ class Translations extends Plugin /** * @var string */ - public $schemaVersion = '1.3.6'; + public $schemaVersion = Constants::PLUGIN_SCHEMA_VERSION; // Public Methods // ========================================================================= diff --git a/src/controllers/OrderController.php b/src/controllers/OrderController.php index 7b59b829..b8f1c9da 100644 --- a/src/controllers/OrderController.php +++ b/src/controllers/OrderController.php @@ -349,8 +349,8 @@ public function actionOrderDetail(array $variables = array()) $variables['translatedFiles'][$file->id] = $tempElement->title; } - if ($translatedElement && $element instanceof Entry) { - $previewUrl = Translations::$plugin->urlGenerator->generateFileWebUrl($translatedElement, $file); + if ($element instanceof Entry) { + $previewUrl = Translations::$plugin->urlGenerator->generateFileWebUrl($translatedElement ?: $tempElement, $file); if ($file->status === Constants::FILE_STATUS_PUBLISHED) { $variables['webUrls'][$file->id] = $previewUrl; diff --git a/src/services/job/ImportFiles.php b/src/services/job/ImportFiles.php index 532c6b09..f4cab684 100644 --- a/src/services/job/ImportFiles.php +++ b/src/services/job/ImportFiles.php @@ -95,13 +95,19 @@ public function processFile( Asset $asset, $order = null , $fileFormat = null, $ } else if ($this->fileFormat === Constants::FILE_FORMAT_XML) { return $this->processXmlFile($asset, $file_content); } else { - $this->order->logActivity(Translations::$plugin->translator->translate('app', "File {($this->fileNames[$asset->id] ?? $asset->getFilename())} is invalid, please try again with a valid zip/xml/json/csv file.")); + $this->order->logActivity(sprintf( + "File {%s} is invalid, please try again with a valid zip/xml/json/csv file.", + $this->fileNames[$asset->id] ?? $asset->getFilename() + )); Translations::$plugin->orderRepository->saveOrder($this->order); return false; } } else { //Invalid - $this->order->logActivity(Translations::$plugin->translator->translate('app', "File {($this->fileNames[$asset->id] ?? $asset->getFilename())} is invalid, please try again with a valid zip/xml/json/csv file.")); + $this->order->logActivity(sprintf( + "File {%s} is invalid, please try again with a valid zip/xml/json/csv file.", + $this->fileNames[$asset->id] ?? $asset->getFilename() + )); Translations::$plugin->orderRepository->saveOrder($this->order); return false; }