ILIAS  release_4-4 Revision
Internationalization

To add a new language: More...

+ Collaboration diagram for Internationalization:

Files

file  spanish.php
 
file  german.php
 
file  spanish.php
 

Functions

 CASClient::getLang ()
 This method returns the language used by phpCAS. More...
 
 CASClient::getString ($str)
 This method returns a string depending on the language. More...
 
 CASClient::setLang ($lang)
 This method is used to set the language used by phpCAS. More...
 

Variables

 CASClient::$_lang
 A string corresponding to the language used by phpCAS. More...
 
 CASClient::$_strings
 array containing the strings used by phpCAS. More...
 
const PHPCAS_LANG_DEFAULT PHPCAS_LANG_ENGLISH
 phpCAS default language (when phpCAS::setLang() is not used) More...
 
const PHPCAS_LANG_DEFAULT PHPCAS_LANG_ENGLISH
 phpCAS default language (when phpCAS::setLang() is not used) More...
 

Detailed Description

To add a new language:

Function Documentation

◆ getLang()

CASClient::getLang ( )
private

This method returns the language used by phpCAS.

Returns
a string representing the language

Definition at line 194 of file client.php.

References CASClient\$_lang, PHPCAS_LANG_DEFAULT, and CASClient\setLang().

Referenced by CASClient\getString().

195  {
196  if ( empty($this->_lang) )
198  return $this->_lang;
199  }
const PHPCAS_LANG_DEFAULT
phpCAS default language (when phpCAS::setLang() is not used)
Definition: CAS.php:246
setLang($lang)
This method is used to set the language used by phpCAS.
Definition: client.php:241
$_lang
A string corresponding to the language used by phpCAS.
Definition: client.php:185
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getString()

CASClient::getString (   $str)
private

This method returns a string depending on the language.

Parameters
$strthe index of the string in $_string.
Returns
the string corresponding to $index in $string.

Definition at line 221 of file client.php.

References _strings, and CASClient\getLang().

Referenced by CASClient\authError(), CASClient\logout(), CASClient\printHTMLFooter(), CASClient\redirectToCas(), and CASClient\serviceWeb().

222  {
223  // call CASclient::getLang() to be sure the language is initialized
224  $this->getLang();
225 
226  if ( !isset($this->_strings[$str]) ) {
227  trigger_error('string `'.$str.'\' not defined for language `'.$this->getLang().'\'',E_USER_ERROR);
228  }
229  return $this->_strings[$str];
230  }
getLang()
This method returns the language used by phpCAS.
Definition: client.php:194
$this _strings
Definition: catalan.php:10
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLang()

CASClient::setLang (   $lang)

This method is used to set the language used by phpCAS.

Note
Can be called only once.
Parameters
$langa string representing the language.
See also
CAS_LANG_FRENCH, CAS_LANG_ENGLISH

Definition at line 241 of file client.php.

References $lang, and _strings.

Referenced by CASClient\getLang().

242  {
243  // include the corresponding language file
244  include_once(dirname(__FILE__).'/languages/'.$lang.'.php');
245 
246  if ( !is_array($this->_strings) ) {
247  trigger_error('language `'.$lang.'\' is not implemented',E_USER_ERROR);
248  }
249  $this->_lang = $lang;
250  }
$this _strings
Definition: catalan.php:10
+ Here is the caller graph for this function:

Variable Documentation

◆ $_lang

CASClient::$_lang
private

A string corresponding to the language used by phpCAS.

Written by CASClient::setLang(), read by CASClient::getLang().

Note
debugging information is always in english (debug purposes only).
See also
CASClient::_strings, CASClient::getString()

Definition at line 185 of file client.php.

Referenced by CASClient\getLang(), and CASClient\setHTMLFooter().

◆ $_strings

CASClient::$_strings
private

array containing the strings used by phpCAS.

Written by CASClient::setLang(), read by CASClient::getString() and used by CASClient::setLang().

Note
This array is filled by instructions in CAS/languages/<$this->_lang>.php
See also
CASClient::_lang, CASClient::getString(), CASClient::setLang(), CASClient::getLang()

Definition at line 210 of file client.php.

Referenced by CASClient\getLang().

◆ PHPCAS_LANG_DEFAULT [1/2]

const PHPCAS_LANG_DEFAULT PHPCAS_LANG_ENGLISH

phpCAS default language (when phpCAS::setLang() is not used)

Definition at line 160 of file CAS.php.

◆ PHPCAS_LANG_DEFAULT [2/2]

const PHPCAS_LANG_DEFAULT PHPCAS_LANG_ENGLISH

phpCAS default language (when phpCAS::setLang() is not used)

Definition at line 246 of file CAS.php.

Referenced by CASClient\getLang().