From 5468d33e7d78beeee1287c7afade3819f90d4649 Mon Sep 17 00:00:00 2001 From: infograf768 Date: Thu, 5 Sep 2019 10:29:36 +0200 Subject: [PATCH] Fix: Creating Multilingual sample data error when only one (#26161) --- installation/controller/setdefaultlanguage.php | 13 +++++++++++++ installation/language/en-GB/en-GB.ini | 1 + 2 files changed, 14 insertions(+) diff --git a/installation/controller/setdefaultlanguage.php b/installation/controller/setdefaultlanguage.php index 8ea733b6eef40..db5e142e37c70 100644 --- a/installation/controller/setdefaultlanguage.php +++ b/installation/controller/setdefaultlanguage.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\CMS\Language\LanguageHelper; + /** * Controller class to set the default application languages for the Joomla Installer. * @@ -96,6 +98,17 @@ public function execute() if ((int) $data['activateMultilanguage']) { + if (count(LanguageHelper::getInstalledLanguages(0)) < 2) + { + $app->enqueueMessage(JText::_('INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_MULTILANG'), 'warning'); + + $r = new stdClass; + + // Redirect to the same page. + $r->view = 'defaultlanguage'; + $app->sendJsonResponse($r); + } + if (!$model->enablePlugin('plg_system_languagefilter')) { $app->enqueueMessage(JText::sprintf('INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER', $frontend_lang), 'warning'); diff --git a/installation/language/en-GB/en-GB.ini b/installation/language/en-GB/en-GB.ini index 53897f5ead9c5..9767d6685da8d 100644 --- a/installation/language/en-GB/en-GB.ini +++ b/installation/language/en-GB/en-GB.ini @@ -168,6 +168,7 @@ INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_MODULESWHITCHER_LANGUAGECODE="Joomla was INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGECODE="Joomla was unable to automatically enable the Language Code Plugin." INSTL_DEFAULTLANGUAGE_COULD_NOT_ENABLE_PLG_LANGUAGEFILTER="Joomla was unable to automatically enable the Language Filter Plugin." INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_LANGUAGE="Joomla was unable to install %s language." +INSTL_DEFAULTLANGUAGE_COULD_NOT_INSTALL_MULTILANG="Joomla was unable to install the multilingual sample data as only one language is installed. To activate the multilingual feature, you need to install more languages, press the 'Previous' button and choose the desired languages from the list." INSTL_DEFAULTLANGUAGE_COULD_NOT_PUBLISH_MOD_MULTILANGSTATUS="Joomla was unable to automatically publish the language status module." INSTL_DEFAULTLANGUAGE_COULD_NOT_UNPUBLISH_MOD_DEFAULTMENU="Joomla was unable to automatically unpublish the default menu module." INSTL_DEFAULTLANGUAGE_DESC="Joomla has installed the following languages. Please select your desired default language for the Joomla Administrator."