Backend\Core\Language\Language::setWorkingLanguage PHP Method

setWorkingLanguage() public static method

Set the current working language
public static setWorkingLanguage ( string $language )
$language string The language to use, if not provided we will use the working language.
    public static function setWorkingLanguage($language)
    {
        self::$currentWorkingLanguage = (string) $language;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param string $language
  *
  * @throws Exception If the provided language is not valid
  */
 public function setLanguage($language)
 {
     // get the possible languages
     $possibleLanguages = BackendLanguage::getWorkingLanguages();
     // validate
     if (!array_key_exists($language, $possibleLanguages)) {
         throw new Exception('Language invalid.');
     }
     // set working language
     BackendLanguage::setWorkingLanguage($language);
 }
All Usage Examples Of Backend\Core\Language\Language::setWorkingLanguage