Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.2] Languagefilter: Add message when no content language is published #505

Open
joomlapl-bot opened this issue Apr 24, 2024 · 0 comments

Comments

@joomlapl-bot
Copy link
Collaborator

PR w związku ze zmianą oryginału joomla/joomla-cms#43232 Poniżej zmiany w oryginale:

Click to expand the diff!
diff --git a/administrator/language/en-GB/plg_system_languagefilter.ini b/administrator/language/en-GB/plg_system_languagefilter.ini
index e23fed35d4ec6..1ef0ade87b738 100644
--- a/administrator/language/en-GB/plg_system_languagefilter.ini
+++ b/administrator/language/en-GB/plg_system_languagefilter.ini
@@ -5,6 +5,7 @@
 
 PLG_SYSTEM_LANGUAGEFILTER="System - Language Filter"
 PLG_SYSTEM_LANGUAGEFILTER_BROWSER_SETTINGS="Browser Settings"
+PLG_SYSTEM_LANGUAGEFILTER_ERROR_NO_CONTENT_LANGUAGE="You have no content language published, but have enabled the Language Filter plugin. This will result in numerous errors!"
 PLG_SYSTEM_LANGUAGEFILTER_FIELD_ALTERNATE_META_LABEL="Add Alternate Meta Tags"
 PLG_SYSTEM_LANGUAGEFILTER_FIELD_AUTOMATIC_CHANGE_LABEL="Automatic Language Change"
 PLG_SYSTEM_LANGUAGEFILTER_FIELD_COOKIE_LABEL="Cookie Lifetime"
diff --git a/plugins/system/languagefilter/src/Extension/LanguageFilter.php b/plugins/system/languagefilter/src/Extension/LanguageFilter.php
index bd49c509e0d2e..d1dbaa5a29a4f 100644
--- a/plugins/system/languagefilter/src/Extension/LanguageFilter.php
+++ b/plugins/system/languagefilter/src/Extension/LanguageFilter.php
@@ -22,6 +22,7 @@
 use Joomla\CMS\Language\LanguageFactoryInterface;
 use Joomla\CMS\Language\LanguageHelper;
 use Joomla\CMS\Language\Multilanguage;
+use Joomla\CMS\Language\Text;
 use Joomla\CMS\Plugin\CMSPlugin;
 use Joomla\CMS\Router\Route;
 use Joomla\CMS\Router\Router;
@@ -158,6 +159,11 @@ public function __construct(
                 }
             }
         }
+
+        if (!\count($this->sefs)) {
+            $this->loadLanguage();
+            $app->enqueueMessage(Text::_('PLG_SYSTEM_LANGUAGEFILTER_ERROR_NO_CONTENT_LANGUAGE'), 'error');
+        }
     }
 
     /**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants