SimpleSAML\Locale\Translate::includeLanguageFile PHP Method

includeLanguageFile() public method

Include a language file from the dictionaries directory.
public includeLanguageFile ( string $file, SimpleSAML_Configuration | null $otherConfig = null )
$file string File name of dictionary to include
$otherConfig SimpleSAML_Configuration | null Optionally provide a different configuration object than the one provided in the constructor to be used to find the directory of the dictionary. This allows to combine dictionaries inside the SimpleSAMLphp main code distribution together with external dictionaries. Defaults to null.
    public function includeLanguageFile($file, $otherConfig = null)
    {
        if (!empty($otherConfig)) {
            $filebase = $otherConfig->getPathValue('dictionarydir', 'dictionaries/');
        } else {
            $filebase = $this->configuration->getPathValue('dictionarydir', 'dictionaries/');
        }
        $lang = $this->readDictionaryFile($filebase . $file);
        \SimpleSAML\Logger::debug('Template: Merging language array. Loading [' . $file . ']');
        $this->langtext = array_merge($this->langtext, $lang);
    }

Usage Example

Esempio n. 1
0
 /**
  * @param      $file
  * @param null $otherConfig
  * @deprecated This method will be removed in SSP 2.0. Please use
  * \SimpleSAML\Locale\Translate::includeLanguageFile() instead.
  */
 public function includeLanguageFile($file, $otherConfig = null)
 {
     $this->translator->includeLanguageFile($file, $otherConfig);
 }