Class LanguageBase

Description

Language table manager

When PHP2Go initializes, the default language table of the framework is loaded into the singleton of the LanguageBase class. That's the way the core classes retrieve internationalized messages.

By adding a LANGUAGE.MESSAGES_PATH in the global configuration settings, you're able to create your own language domains, which are also accessible from this class. The only difference is that when using custom domains, the domain must be provided together with the name of the language entry.

  1.  $lang =LanguageBase::getInstance();
  2.  $lang->getLanguageValue('MY_DOMAIN:MY_KEY');
  3.  $lang->getLanguageValue('MY_DOMAIN:PATH.TO.MY_KEY');

Located in /core/LanguageBase.class.php (line 51)


	
			
Variable Summary
Method Summary
string|NULL getLanguageValue (string $key, [mixed $params = NULL])
void loadLanguageTableByFile (string $languageFile, string $domain)
void loadLanguageTableByValue (array $languageTable, string $domain)
void _loadLanguageDomain (string $domain)
Variables
array $languageBase (line 59)

Loaded language entries

  • access: private
Methods
static method getInstance (line 79)

Get the singleton of the LanguageBase class

static LanguageBase &getInstance ()
Constructor LanguageBase (line 69)

Class constructor

Shouldn't be called directly. Always use getInstance to read, add or modify language entries.

LanguageBase LanguageBase ()
clearLanguageBase (line 89)

Clear all loaded language entries

void clearLanguageBase ()
getLanguageValue (line 133)

Resolve a given language entry

The $params attribute expects a single substitution variable or an array of substitution variables. This variables are used to replace printf placeholders inside the message.

string|NULL getLanguageValue (string $key, [mixed $params = NULL])
  • string $key: Language entry key
  • mixed $params: Substitution arguments
loadLanguageTableByFile (line 118)

Loads language entries from a file

This method is called inside Init class to load internationalized messages used by the framework into the 'PHP2GO' language domain.

void loadLanguageTableByFile (string $languageFile, string $domain)
  • string $languageFile: Language file
  • string $domain: Domain that must receive the new entries
loadLanguageTableByValue (line 99)

Add/replace a set of language entries in a given language domain

void loadLanguageTableByValue (array $languageTable, string $domain)
  • array $languageTable: Set of language entries
  • string $domain: Domain
_loadLanguageDomain (line 167)

Loads a given language domain

Based on the messages path (LANGUAGE.MESSAGES_PATH) and on the active language code (LANGUAGE_CODE), determine the path of the language domain file in the file system. Tries to read that file, and load its contents into the language table in case of success.

  • access: private
void _loadLanguageDomain (string $domain)
  • string $domain: Domain name

Documentation generated on Sun, 07 Oct 2007 19:26:56 -0300 by phpDocumentor 1.3.2