use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Helper\Application\ApplicationHelper;
+use Org\Mxchange\CoreFramework\Localization\ManageableLanguage;
use Org\Mxchange\CoreFramework\Loader\ClassLoader;
use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
*/
private static $databaseInstance = NULL;
+ /**
+ * Language system instance
+ */
+ private static $languageInstance = NULL;
+
/*
* Includes applications may have. They will be tried in the given order,
* some will become soon deprecated.
return self::$databaseInstance;
}
+ /**
+ * Private getter for language instance
+ *
+ * @return $languageInstance An instance of a ManageableLanguage class
+ */
+ public static function getLanguageInstance () {
+ return self::$languageInstance;
+ }
+
+ /**
+ * Setter for language instance
+ *
+ * @param $languageInstance An instance of a ManageableLanguage class
+ * @return void
+ */
+ public static function setLanguageInstance (ManageableLanguage $languageInstance) {
+ self::$languageInstance = $languageInstance;
+ }
+
}
use Org\Mxchange\CoreFramework\Handler\Handleable;
use Org\Mxchange\CoreFramework\Helper\Helper;
use Org\Mxchange\CoreFramework\Loader\ClassLoader;
-use Org\Mxchange\CoreFramework\Localization\ManageableLanguage;
use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
return $webOutputInstance;
}
- /**
- * Private getter for language instance
- *
- * @return $langInstance An instance to the language sub-system
- */
- protected final function getLanguageInstance () {
- $langInstance = GenericRegistry::getRegistry()->getInstance('language');
- return $langInstance;
- }
-
- /**
- * Setter for language instance
- *
- * @param $langInstance An instance to the language sub-system
- * @return void
- * @see LanguageSystem
- */
- public final function setLanguageInstance (ManageableLanguage $langInstance) {
- GenericRegistry::getRegistry()->addInstance('language', $langInstance);
- }
-
/**
* Protected setter for user instance
*
namespace Org\Mxchange\CoreFramework\Command;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('page_' . $applicationInstance->getAppShortName() . '_' . $this->getResolverInstance()->getCommandName() . '_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('page_' . $applicationInstance->getAppShortName() . '_' . $this->getResolverInstance()->getCommandName() . '_title'));
// Construct the menu in every command. We could do this in BaseCommand class. But this means
// *every* command has a navigation system and that is want we don't want.
namespace Org\Mxchange\CoreFramework\Command\Guest;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('page_confirm_link_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('page_confirm_link_title'));
// Get user instance
try {
namespace Org\Mxchange\CoreFramework\Command\Guest;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('page_home_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('page_home_title'));
// Construct the menu in every command. We could do this in BaseCommand class. But this means
// *every* command has a navigation system and that is want we don't want.
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName . '_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage($this->actionName . '_title'));
// Construct the menu in every command. We could do this in BaseCommand class. But this means
// *every* command has a navigation system and that is want we don't want.
namespace Org\Mxchange\CoreFramework\Command\Login;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('page_login_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('page_login_title'));
// Construct the menu in every command. We could do this in BaseCommand class. But this means
// *every* command has a navigation system and that is want we don't want.
namespace Org\Mxchange\CoreFramework\Command\Failed;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('login_failed_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('login_failed_title'));
// Assign base URL
$this->getTemplateInstance()->assignConfigVariable('base_url');
namespace Org\Mxchange\CoreFramework\Command\Logout;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('logout_done_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('logout_done_title'));
// Assign base URL
$this->getTemplateInstance()->assignConfigVariable('base_url');
namespace Org\Mxchange\CoreFramework\Command\Register;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('page_register_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('page_register_title'));
// Construct the menu in every command. We could do this in BaseCommand class. But this means
// *every* command has a navigation system and that is want we don't want.
namespace Org\Mxchange\CoreFramework\Command\Status;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Command\BaseCommand;
use Org\Mxchange\CoreFramework\Command\Commandable;
use Org\Mxchange\CoreFramework\Controller\Controller;
$this->getTemplateInstance()->loadCodeTemplate($masterTemplate);
// Set title
- $this->getTemplateInstance()->assignVariable('title', $this->getLanguageInstance()->getMessage('page_status_title'));
+ $this->getTemplateInstance()->assignVariable('title', FrameworkBootstrap::getLanguageInstance()->getMessage('page_status_title'));
// Construct the menu in every command. We could do this in BaseCommand class. But this means
// *every* command has a navigation system and that is want we don't want.
*/
public function assignMessageField (string $templateVariable, string $messageId) {
// Get message
- $message = $this->getLanguageInstance()->getMessage($messageId);
+ $message = FrameworkBootstrap::getLanguageInstance()->getMessage($messageId);
// And assign it
$this->getTemplateInstance()->assignVariable($templateVariable, $message);
*/
protected function doFilterUserStatusTranslator (string $userStatus) {
// Generate message id
- $messageId = 'user_status_' . strtolower($userStatus);
+ $messageId = sprintf('user_status_%s', strtolower($userStatus));
// Get that message
- $translated = $this->getLanguageInstance()->getMessage($messageId);
+ $translated = FrameworkBootstrap::getLanguageInstance()->getMessage($messageId);
// Return it
return $translated;
*/
public function addActionLinkById ($linkAction, $languageId) {
// Resolve the language string
- $languageResolvedText = $this->getLanguageInstance()->getMessage('link_' . $languageId . '_text');
+ $languageResolvedText = FrameworkBootstrap::getLanguageInstance()->getMessage('link_' . $languageId . '_text');
// Resolve the language string
- $languageResolvedTitle = $this->getLanguageInstance()->getMessage('link_' . $languageId . '_title');
+ $languageResolvedTitle = FrameworkBootstrap::getLanguageInstance()->getMessage('link_' . $languageId . '_title');
// Add the action link
$this->addActionLink($linkAction, $languageResolvedText, $languageResolvedTitle);
*/
public function addLinkWithTextById ($languageId) {
// Resolve the language string
- $languageResolvedText = $this->getLanguageInstance()->getMessage('link_' . $languageId . '_text');
+ $languageResolvedText = FrameworkBootstrap::getLanguageInstance()->getMessage('link_' . $languageId . '_text');
// Resolve the language string
- $languageResolvedTitle = $this->getLanguageInstance()->getMessage('link_' . $languageId . '_title');
+ $languageResolvedTitle = FrameworkBootstrap::getLanguageInstance()->getMessage('link_' . $languageId . '_title');
// Now add the link
$linkContent = $this->renderLinkContentWithTextExtraContent($languageResolvedText, $languageResolvedTitle);
* @throws LanguagePathReadProtectedException If $languageBasePath is
* read-protected
*/
- public static final function createLanguageSystem ($languageBasePath = '') {
+ public static final function createLanguageSystem (string $languageBasePath = '') {
// Get a new instance
$langInstance = new LanguageSystem();
* @param $languageBasePath The relative base path for all language files
* @return void
*/
- protected final function setLanguageBasePath ($languageBasePath) {
+ protected final function setLanguageBasePath (string $languageBasePath) {
// And set it
$this->languageBasePath = (string) $languageBasePath;
}
* @param $langCode The language code for the current application
* @return void
*/
- protected final function setLanguageCode ($langCode) {
- // Cast it
- $langCode = (string) $langCode;
-
+ protected final function setLanguageCode (string $langCode) {
// And set it (only 2 chars)
$this->langCode = substr($langCode, 0, 2);
}
* @param $messageId The message id we shall find in the cache variable
* @return $messageText The plain message text
*/
- public function getMessage ($messageId) {
+ public function getMessage (string $messageId) {
// Default is missing message text
$messageText = sprintf('!%s!',
$messageId
* @return void
*/
public final function addFatalMessage ($messageId) {
- // Get application instance
- $applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
-
// Adds the resolved message id to the fatal message list
- $this->addFatalMessagePlain($applicationInstance->getLanguageInstance()->getMessage($messageId));
+ $this->addFatalMessagePlain(FrameworkBootstrap::getLanguageInstance()->getMessage($messageId));
}
/**
*
* @param $value The raw value from e.g. database
* @return $localized Localized value
- * @todo Won't work as getLanguageInstance() is still in monolithic BaseFrameworkSystem
*/
public static function doFilterFormatNumber ($value) {
// Generate it from config and localize dependencies
*
* @param $timestamp Timestamp to prepare (filter) for display
* @return $readable A readable timestamp
- * @todo Won't work as getLanguageInstance() is still in monolithic BaseFrameworkSystem
*/
public static function doFilterFormatTimestamp ($timestamp) {
// Default value to return