ILIAS
trunk Revision v11.0_alpha-1866-gfa368f7776e
|
language handling for setup More...
Public Member Functions | |
__construct (string $a_lang_key) | |
txt (string $a_topic, string $a_default_lang_fallback_mod='') | |
gets the text for a given topic More... | |
installLanguages (array $a_lang_keys, array $a_local_keys) | |
install languages More... | |
getInstalledLanguages () | |
get already installed languages (in db) More... | |
getInstalledLocalLanguages () | |
get already installed local languages (in db) More... | |
getLocalChanges (string $a_lang_key, string $a_min_date="", string $a_max_date="") | |
get locally changed language entries $a_lang_key language key $a_min_date minimum change date "yyyy-mm-dd hh:mm:ss" $a_max_date maximum change date "yyyy-mm-dd hh:mm:ss" Returned value [module][identifier] => value More... | |
getLocalLanguages () | |
Searches for the existence of *.lang.local files. More... | |
getInstallableLanguages () | |
Return installable languages. More... | |
setDbHandler (ilDBInterface $a_db_handler) | |
set db handler object object db handler Return true on success More... | |
loadLanguageModule (string $a_module) | |
![]() | |
__construct (string $a_lang_key) | |
Constructor read the single-language file and put this in an array text. More... | |
getLangKey () | |
Return lang key. More... | |
getDefaultLanguage () | |
Return default language. More... | |
getTextDirection () | |
Return text direction. More... | |
getContentLanguage () | |
Return content language. More... | |
txtlng (string $a_module, string $a_topic, string $a_language) | |
gets the text for a given topic in a given language if the topic is not in the list, the topic itself with "-" will be returned More... | |
txt (string $a_topic, string $a_default_lang_fallback_mod="") | |
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be returned More... | |
exists (string $a_topic) | |
Check if language entry exists. More... | |
loadLanguageModule (string $a_module) | |
Load language module. More... | |
getInstalledLanguages () | |
Get installed languages. More... | |
getUsedTopics () | |
Return used topics. More... | |
getUsedModules () | |
Return used modules. More... | |
getUserLanguage () | |
Return language of user. More... | |
getCustomLangPath () | |
toJS ($a_lang_key, ?ilGlobalTemplateInterface $a_tpl=null) | |
Transfer text to Javascript. More... | |
toJSMap (array $a_map, ?ilGlobalTemplateInterface $a_tpl=null) | |
Transfer text to Javascript. More... | |
__destruct () | |
destructor saves all language usages to db if log is enabled and ilDB exists More... | |
![]() | |
toJS ($key) | |
Static Public Member Functions | |
static | _deleteLangData (string $a_lang_key, bool $a_keep_local_change) |
Delete languge data. More... | |
![]() | |
static | _getInstalledLanguages () |
Get installed languages. More... | |
static | _lookupEntry (string $a_lang_key, string $a_mod, string $a_id) |
static | lookupId (string $a_lang_key) |
Lookup obj_id of language. More... | |
static | getFallbackInstance () |
Builds a global default language instance. More... | |
static | getGlobalInstance () |
Builds the global language object. More... | |
Data Fields | |
array | $text |
string | $lang_default = "en" |
string | $lang_path |
string | $lang_key |
string | $separator = "#:#" |
string | $comment_separator = "###" |
![]() | |
ILIAS | $ilias |
array | $text = [] |
string | $lang_default |
string | $lang_user |
string | $lang_path |
string | $lang_key |
string | $lang_name |
string | $separator = "#:#" |
string | $comment_separator = "###" |
array | $loaded_modules = array() |
Protected Member Functions | |
getAvailableLanguages () | |
get already registered languages (in db) More... | |
checkLanguage (string $a_lang_key, string $scope="") | |
validate the logical structure of a lang-file More... | |
cut_header (array $content) | |
Remove *.lang header information from '$content'. More... | |
flushLanguage (string $a_lang_key, string $a_mode="all") | |
remove language data from database $a_lang_key language key $a_mode "all" or "keep_local" More... | |
insertLanguage (string $lang_key, string $scope="") | |
insert language data from file in database More... | |
Protected Attributes | |
ilDBInterface | $db |
![]() | |
array | $cached_modules = array() |
array | $map_modules_txt = array() |
bool | $usage_log_enabled = false |
string | $cust_lang_path |
ilLogger | $log |
ilCachedLanguage | $global_cache |
Additional Inherited Members | |
![]() | |
static | logUsage (string $a_module, string $a_identifier) |
saves tupel of language module and identifier More... | |
static | isUsageLogEnabled () |
checks if language usage log is enabled you need MySQL to use this function this function is automatically enabled if DEVMODE is on this function is also enabled if language_log is 1 More... | |
![]() | |
static array | $used_topics = array() |
static array | $used_modules = array() |
static array | $lng_log = array() |
language handling for setup
this class offers the language handling for an application. the constructor is called with a small language abbreviation e.g. $lng = new Language("en"); the constructor reads the single-languagefile en.lang and puts this into an array. with e.g. $lng->txt("user_updated"); you can translate a lang-topic into the actual language
The DATE field is not set correctly on changes of a language (update, install, your stable). The format functions do not belong in class.Language. Those are also applicable elsewhere. Therefore, they would be better placed in class.Format
This somehow needs to be reconciled with the base class and most probably be factored into two classes, one for management, one for retrieval.
Definition at line 42 of file class.ilSetupLanguage.php.
ilSetupLanguage::__construct | ( | string | $a_lang_key | ) |
|
static |
Delete languge data.
$a_lang_key lang key
Definition at line 357 of file class.ilSetupLanguage.php.
References $ilDB.
|
protected |
validate the logical structure of a lang-file
This function checks if a lang-file of a given lang_key exists, the file has a header, and each lang-entry consists of exactly three elements (module, identifier, value).
$a_lang_key international language key (2 digits) $scope empty (global) or "local" $info_text message about results of check OR "1" if all checks successfully passed
Definition at line 264 of file class.ilSetupLanguage.php.
References ilLanguage\$cust_lang_path, $lang_path, $path, $scope, and cut_header().
Referenced by installLanguages().
|
protected |
Remove *.lang header information from '$content'.
This function seeks for a special keyword where the language information starts. If found it returns the plain language information; otherwise returns false.
$content expect an ILIAS lang-file
Definition at line 325 of file class.ilSetupLanguage.php.
Referenced by checkLanguage(), and insertLanguage().
|
protected |
remove language data from database $a_lang_key language key $a_mode "all" or "keep_local"
Definition at line 340 of file class.ilSetupLanguage.php.
References $ilDB.
Referenced by installLanguages().
|
protected |
get already registered languages (in db)
Definition at line 235 of file class.ilSetupLanguage.php.
Referenced by installLanguages().
ilSetupLanguage::getInstallableLanguages | ( | ) |
Return installable languages.
Definition at line 580 of file class.ilSetupLanguage.php.
References Vendor\Package\$d, and $lang_key.
ilSetupLanguage::getInstalledLanguages | ( | ) |
ilSetupLanguage::getInstalledLocalLanguages | ( | ) |
get already installed local languages (in db)
Definition at line 214 of file class.ilSetupLanguage.php.
ilSetupLanguage::getLocalChanges | ( | string | $a_lang_key, |
string | $a_min_date = "" , |
||
string | $a_max_date = "" |
||
) |
get locally changed language entries $a_lang_key language key $a_min_date minimum change date "yyyy-mm-dd hh:mm:ss" $a_max_date maximum change date "yyyy-mm-dd hh:mm:ss" Returned value [module][identifier] => value
Definition at line 378 of file class.ilSetupLanguage.php.
References $ilDB, $q, and ilDBConstants\FETCHMODE_ASSOC.
Referenced by insertLanguage().
ilSetupLanguage::getLocalLanguages | ( | ) |
Searches for the existence of *.lang.local files.
Returns array with language keys
Definition at line 555 of file class.ilSetupLanguage.php.
References Vendor\Package\$d, and $lang_key.
|
protected |
insert language data from file in database
$lang_key international language key (2 digits) $scope empty (global) or "local"
Definition at line 413 of file class.ilSetupLanguage.php.
References ilLanguage\$cust_lang_path, $ilDB, $lang_path, $path, $q, $scope, cut_header(), getLocalChanges(), and null.
Referenced by installLanguages().
ilSetupLanguage::installLanguages | ( | array | $a_lang_keys, |
array | $a_local_keys | ||
) |
install languages
$a_lang_keys array with lang_keys of languages to install
Definition at line 100 of file class.ilSetupLanguage.php.
References $ilDB, $lang_key, checkLanguage(), flushLanguage(), getAvailableLanguages(), and insertLanguage().
ilSetupLanguage::loadLanguageModule | ( | string | $a_module | ) |
Implements ILIAS\Language\Language.
Definition at line 611 of file class.ilSetupLanguage.php.
ilSetupLanguage::setDbHandler | ( | ilDBInterface | $a_db_handler | ) |
set db handler object object db handler Return true on success
Definition at line 605 of file class.ilSetupLanguage.php.
ilSetupLanguage::txt | ( | string | $a_topic, |
string | $a_default_lang_fallback_mod = '' |
||
) |
gets the text for a given topic
if the topic is not in the list, the topic itself with "-" will be returned
$a_topic topic
Implements ILIAS\Language\Language.
Definition at line 67 of file class.ilSetupLanguage.php.
References ilLanguage\$log.
string ilSetupLanguage::$comment_separator = "###" |
Definition at line 49 of file class.ilSetupLanguage.php.
|
protected |
Definition at line 50 of file class.ilSetupLanguage.php.
string ilSetupLanguage::$lang_default = "en" |
Definition at line 45 of file class.ilSetupLanguage.php.
Referenced by __construct().
string ilSetupLanguage::$lang_key |
Definition at line 47 of file class.ilSetupLanguage.php.
Referenced by getInstallableLanguages(), getLocalLanguages(), and installLanguages().
string ilSetupLanguage::$lang_path |
Definition at line 46 of file class.ilSetupLanguage.php.
Referenced by checkLanguage(), and insertLanguage().
string ilSetupLanguage::$separator = "#:#" |
Definition at line 48 of file class.ilSetupLanguage.php.
array ilSetupLanguage::$text |
Definition at line 44 of file class.ilSetupLanguage.php.