]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 22 Aug 2025 03:35:40 +0000 (05:35 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 22 Aug 2025 03:35:40 +0000 (05:35 +0200)
- language sub-system should be singleton

framework/main/classes/language/class_LanguageSystem.php

index f46e8ed21a14d424a5df9318f1e3e1ec2e7a7fbe..a1454b9d14a0acfaa7cec8af9960a3e5adf2c33b 100644 (file)
@@ -118,9 +118,6 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
                // Set language code from default config
                $langInstance->setLanguageCode(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('default_lang'));
 
-               // Remember this instance
-               self::$selfInstance = $langInstance;
-
                // Return the prepared instance
                return $langInstance;
        }
@@ -131,6 +128,13 @@ class LanguageSystem extends BaseFrameworkSystem implements ManageableLanguage,
         * @return      $selfInstance   An instance of this class
         */
        public static final function getSelfInstance (): ManageableLanguage {
+               // Is an instance set?
+               if (!(self::$selfInstance instanceof ManageableLanguage)) {
+                       // Init instance with auto-detected path
+                       self::$selfInstance = self::createLanguageSystem();
+               }
+
+               //.Return singleton instance
                return self::$selfInstance;
        }