diff --git a/README.md b/README.md index 276868f..fb6627f 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ phpunit --bootstrap craft/app/tests/bootstrap.php --configuration craft/plugins/ Changelog ================= +###0.4.3### +- Fixed a bug where translations wouldn't be shown on sites with only 1 locale defined (thanks to @janhenckens) + ###0.4.2### - Add node_modules to excluded vendor folders (thanks to @tcsehv) diff --git a/TranslatePlugin.php b/TranslatePlugin.php index 0100a24..7cf2341 100644 --- a/TranslatePlugin.php +++ b/TranslatePlugin.php @@ -30,7 +30,7 @@ public function getName() */ public function getVersion() { - return '0.4.2'; + return '0.4.3'; } /** diff --git a/elementtypes/TranslateElementType.php b/elementtypes/TranslateElementType.php index 5f14845..4c468c8 100644 --- a/elementtypes/TranslateElementType.php +++ b/elementtypes/TranslateElementType.php @@ -241,6 +241,11 @@ public function getSources($context = null) */ public function getIndexHtml($criteria, $disabledElementIds, $viewState, $sourceKey, $context, $includeContainer, $showCheckboxes) { + // If the site only has 1 locale enabled, set the translated locale to the primary (and only) locale + if (empty($criteria['locale'])) { + $criteria['locale'] = craft()->i18n->getPrimarySiteLocale(); + } + $variables = array( 'viewMode' => $viewState['mode'], 'context' => $context,