|
ILIAS
trunk Revision v13.0_alpha-62-g3b72d83f2e5
|
language handling for setup More...
Inheritance diagram for ilSetupLanguage:
Collaboration diagram for ilSetupLanguage:Public Member Functions | |
| __construct (string $a_lang_key, ?LanguageFileDirectoryManager $language_file_directory_manager=null, private readonly ?ilDBInterface $connection=null, private readonly TranslationCache $translation_cache=new NullTranslationCache(), private readonly ?LoggerInterface $logger=null, private readonly ?\Closure $client_data_dir_resolver=null,) | |
| setClientDataDir (?string $client_data_dir) | |
null resets to the resolver of the constructor. More... | |
| getClientDataDir () | |
| usesDefaultLanguageFileDirectories () | |
| Such an instance (e.g. More... | |
| getLanguageFileDirectoryManager () | |
| installLanguages (array $a_lang_keys, array $a_local_keys=[]) | |
| install languages More... | |
| registerInstalledLanguage (string $lang_key, array $known_languages, array $local_language_keys) | |
| Single place for the object_data row ("installed" vs. More... | |
| getAvailableLanguagesForInstallation () | |
| getInstallableLanguagesForInstallation () | |
| checkLanguageForInstallation (string $lang_key) | |
| checkLocalLanguageFileForInstallation (string $lang_key) | |
| Unlike checkLanguageForInstallation(), a missing local file is not acceptable here. More... | |
| flushLanguageForInstallation (string $lang_key) | |
| flushLanguageForUninstallation (string $lang_key) | |
| getSkippedInvalidMarkupEntries () | |
| getSkippedDuplicateEntries () | |
| getSkippedUnreadableOverlays () | |
| getOverlaysOfUnshippedModules () | |
| getUnrecordedTakenOverModules () | |
| insertLanguageForInstallation (string $lang_key) | |
| insertLanguageForApplyingLocalChanges (string $lang_key) | |
| See LanguageInstallationManager::insertLanguageForApplyingLocalChanges(). More... | |
| findUnwritableOverlayDirectories (array $lang_keys, ?int $for_user_id=null) | |
| File-based, needs no database (unlike manager()). More... | |
| hasMigratedModules (array $lang_keys) | |
| File-based, needs no database. 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... | |
| getInvalidLocalLanguageFiles (array $language_keys) | |
| Local language files that contain a requested key but do not match the naming scheme. More... | |
| getInstallableLanguages () | |
| Return installable languages. More... | |
| setDbHandler (ilDBInterface $a_db_handler) | |
| Takes precedence over $GLOBALS['ilDB']. More... | |
| loadLanguageModule (string $a_module) | |
| Load language module. More... | |
Public Member Functions inherited from ilLanguage | |
| __construct (string $a_lang_key, ?TranslationRepository $translations=null) | |
| 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 Another language than this one is always read via gettext (_lookupEntry()), never from the injected repository. More... | |
| txt (string|LanguageIdentifier $a_topic, ?int $n=null) | |
| 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... | |
Public Member Functions inherited from ILIAS\Language\Language | |
| txt (string|LanguageIdentifier $a_topic, ?int $n=null) | |
| $n selects a plural form, e.g. More... | |
| loadLanguageModule (string $a_module) | |
| getLangKey () | |
| toJS ($key) | |
Static Public Member Functions | |
| static | _deleteLangData (string $a_lang_key, bool $a_keep_local_change) |
| Delete languge data. More... | |
Static Public Member Functions inherited from ilLanguage | |
| static | forgetInstalledLanguage (string $lang_key) |
| $lang_key was uninstalled in this request: its migrated state is no longer served (see isInstalledLanguage()), More... | |
| static | invalidateMigratedLanguageFileCache (string $a_module, string $lang_key) |
| Makes an overlay write (see MigratedLanguageFileSync) visible to the rest of the request. 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_key |
| string | $separator = "#:#" |
| string | $comment_separator = "###" |
Data Fields inherited from ilLanguage | |
| 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 | |
| checkLanguage (string $a_lang_key) | |
| validate the logical structure of a lang-file More... | |
Protected Attributes | |
| ilDBInterface | $db = null |
Protected Attributes inherited from ilLanguage | |
| array | $migrated_key_modules = [] |
| array | $cached_modules = array() |
| array | $map_modules_txt = array() |
| bool | $usage_log_enabled = false |
| string | $cust_lang_path |
| ilLogger | $log |
| ilCachedLanguage | $global_cache |
Private Member Functions | |
| db () | |
| Resolved per call, so a later setDbHandler() takes effect. More... | |
| repository () | |
| Without a database only the file-based methods work. More... | |
| manager () | |
| Kept across calls because the manager collects getSkippedInvalidMarkupEntries() over a run; rebuilt only when db() changes. More... | |
Private Attributes | |
| string | $absolute_path |
| string | $client_data_dir = null |
| readonly bool | $uses_default_language_file_directories |
| readonly LanguageFileDirectoryManager | $language_file_directory_manager |
| LanguageInstallationManager | $manager = null |
| ilDBInterface | $manager_db = null |
Additional Inherited Members | |
Static Protected Member Functions inherited from ilLanguage | |
| 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 Protected Attributes inherited from ilLanguage | |
| 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
Language implementation for Setup (txt() before the runtime DIC exists). Installation is delegated to \ILIAS\Language\Setup\InstalledLanguageRepository (read) and LanguageInstallationManager (write); kept as entry point for callers not wired through Language.php.
Definition at line 53 of file class.ilSetupLanguage.php.
| ilSetupLanguage::__construct | ( | string | $a_lang_key, |
| ?LanguageFileDirectoryManager | $language_file_directory_manager = null, |
||
| private readonly ?ilDBInterface | $connection = null, |
||
| private readonly TranslationCache | $translation_cache = new NullTranslationCache(), |
||
| private readonly ?LoggerInterface | $logger = null, |
||
| private readonly ?\Closure | $client_data_dir_resolver = null |
||
| ) |
| LanguageFileDirectoryManager | null | $language_file_directory_manager | directories contributed through the component graph; without it only main lang/ and customizing are known (usesDefaultLanguageFileDirectories()) |
| ilDBInterface | null | $connection | none for callers outside the component graph |
| LoggerInterface | null | $logger | for the installation manager's warnings; none in the Setup (PHP error log then) |
| ( |
Closure():?string)|null $client_data_dir_resolver without it, MigratedLanguageFilePaths::resolveClientDataDir() is used
Definition at line 75 of file class.ilSetupLanguage.php.
References $lang_default, and $language_file_directory_manager.
|
static |
Delete languge data.
$a_lang_key lang key
Definition at line 406 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)
Definition at line 396 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::checkLanguageForInstallation | ( | string | $lang_key | ) |
Definition at line 253 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::checkLocalLanguageFileForInstallation | ( | string | $lang_key | ) |
Unlike checkLanguageForInstallation(), a missing local file is not acceptable here.
Definition at line 261 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:
|
private |
Resolved per call, so a later setDbHandler() takes effect.
Order: setDbHandler(), constructor connection, $GLOBALS['ilDB'].
Definition at line 98 of file class.ilSetupLanguage.php.
References $GLOBALS, and db().
Referenced by db(), manager(), and repository().
Here is the call graph for this function:
Here is the caller graph for this function:| ilSetupLanguage::findUnwritableOverlayDirectories | ( | array | $lang_keys, |
| ?int | $for_user_id = null |
||
| ) |
File-based, needs no database (unlike manager()).
| list<string> | $lang_keys | |
| int | null | $for_user_id | evaluate the writability for this user instead of the current process |
Definition at line 346 of file class.ilSetupLanguage.php.
| ilSetupLanguage::flushLanguageForInstallation | ( | string | $lang_key | ) |
Definition at line 266 of file class.ilSetupLanguage.php.
| ilSetupLanguage::flushLanguageForUninstallation | ( | string | $lang_key | ) |
Definition at line 271 of file class.ilSetupLanguage.php.
| ilSetupLanguage::getAvailableLanguagesForInstallation | ( | ) |
Definition at line 240 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::getClientDataDir | ( | ) |
Definition at line 146 of file class.ilSetupLanguage.php.
References $client_data_dir.
Referenced by manager().
Here is the caller graph for this function:| ilSetupLanguage::getInstallableLanguages | ( | ) |
Return installable languages.
Definition at line 455 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::getInstallableLanguagesForInstallation | ( | ) |
Definition at line 248 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::getInstalledLanguages | ( | ) |
get already installed languages (in db)
Reimplemented from ilLanguage.
Definition at line 374 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Referenced by ilSetupLanguageTest\databaseMethods().
Here is the call graph for this function:
Here is the caller graph for this function:| ilSetupLanguage::getInstalledLocalLanguages | ( | ) |
get already installed local languages (in db)
Definition at line 382 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::getInvalidLocalLanguageFiles | ( | array | $language_keys | ) |
Local language files that contain a requested key but do not match the naming scheme.
| list<string> | $language_keys |
Definition at line 447 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::getLanguageFileDirectoryManager | ( | ) |
Definition at line 166 of file class.ilSetupLanguage.php.
References $language_file_directory_manager.
| 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 427 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::getLocalLanguages | ( | ) |
Searches for the existence of *.lang.local files.
Returns array with language keys
Definition at line 436 of file class.ilSetupLanguage.php.
References ILIAS\UI\examples\Deck\repository().
Here is the call graph for this function:| ilSetupLanguage::getOverlaysOfUnshippedModules | ( | ) |
Definition at line 303 of file class.ilSetupLanguage.php.
| ilSetupLanguage::getSkippedDuplicateEntries | ( | ) |
Definition at line 287 of file class.ilSetupLanguage.php.
| ilSetupLanguage::getSkippedInvalidMarkupEntries | ( | ) |
Definition at line 279 of file class.ilSetupLanguage.php.
| ilSetupLanguage::getSkippedUnreadableOverlays | ( | ) |
Definition at line 295 of file class.ilSetupLanguage.php.
| ilSetupLanguage::getUnrecordedTakenOverModules | ( | ) |
Definition at line 316 of file class.ilSetupLanguage.php.
| ilSetupLanguage::hasMigratedModules | ( | array | $lang_keys | ) |
File-based, needs no database.
| list<string> | $lang_keys |
Definition at line 362 of file class.ilSetupLanguage.php.
| ilSetupLanguage::insertLanguageForApplyingLocalChanges | ( | string | $lang_key | ) |
See LanguageInstallationManager::insertLanguageForApplyingLocalChanges().
Definition at line 334 of file class.ilSetupLanguage.php.
| ilSetupLanguage::insertLanguageForInstallation | ( | string | $lang_key | ) |
Definition at line 324 of file class.ilSetupLanguage.php.
Referenced by ilSetupLanguageTest\databaseMethods().
Here is the caller graph for this function:| 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 217 of file class.ilSetupLanguage.php.
References manager().
Here is the call graph for this function:| ilSetupLanguage::loadLanguageModule | ( | string | $a_module | ) |
Load language module.
Reimplemented from ilLanguage.
Definition at line 471 of file class.ilSetupLanguage.php.
|
private |
Kept across calls because the manager collects getSkippedInvalidMarkupEntries() over a run; rebuilt only when db() changes.
Definition at line 119 of file class.ilSetupLanguage.php.
References $db, $manager, db(), getClientDataDir(), ILIAS\Repository\logger(), manager(), and repository().
Referenced by installLanguages(), and manager().
Here is the call graph for this function:
Here is the caller graph for this function:| ilSetupLanguage::registerInstalledLanguage | ( | string | $lang_key, |
| array | $known_languages, | ||
| array | $local_language_keys | ||
| ) |
Single place for the object_data row ("installed" vs.
"installed_local"), also used by InstallLanguage::perform().
| array<string,array{obj_id:int,status:string}> | $known_languages result of getAvailableLanguages()/getAvailableLanguagesForInstallation() |
| list<string> | $local_language_keys result of getLocalLanguages() |
Definition at line 232 of file class.ilSetupLanguage.php.
|
private |
Without a database only the file-based methods work.
Definition at line 106 of file class.ilSetupLanguage.php.
References db().
Referenced by manager().
Here is the call graph for this function:
Here is the caller graph for this function:| ilSetupLanguage::setClientDataDir | ( | ?string | $client_data_dir | ) |
null resets to the resolver of the constructor.
Definition at line 141 of file class.ilSetupLanguage.php.
References $client_data_dir.
| ilSetupLanguage::setDbHandler | ( | ilDBInterface | $a_db_handler | ) |
Takes precedence over $GLOBALS['ilDB'].
Return true on success
Definition at line 465 of file class.ilSetupLanguage.php.
Referenced by ilSetupLanguageTest\managerOf().
Here is the caller graph for this function:| ilSetupLanguage::usesDefaultLanguageFileDirectories | ( | ) |
Such an instance (e.g.
‘new ilSetupLanguage('en’)` in plugin Setup Objectives) must not refresh an installed language: that would drop the lng_data rows of every component-contributed module.
Definition at line 161 of file class.ilSetupLanguage.php.
References $uses_default_language_file_directories.
|
private |
Definition at line 55 of file class.ilSetupLanguage.php.
|
private |
Definition at line 62 of file class.ilSetupLanguage.php.
Referenced by getClientDataDir(), and setClientDataDir().
| string ilSetupLanguage::$comment_separator = "###" |
Definition at line 60 of file class.ilSetupLanguage.php.
|
protected |
Definition at line 61 of file class.ilSetupLanguage.php.
Referenced by manager().
| string ilSetupLanguage::$lang_default = "en" |
Definition at line 57 of file class.ilSetupLanguage.php.
Referenced by __construct().
| string ilSetupLanguage::$lang_key |
Definition at line 58 of file class.ilSetupLanguage.php.
|
private |
Definition at line 64 of file class.ilSetupLanguage.php.
Referenced by __construct(), and getLanguageFileDirectoryManager().
|
private |
Definition at line 65 of file class.ilSetupLanguage.php.
Referenced by manager().
|
private |
Definition at line 66 of file class.ilSetupLanguage.php.
| string ilSetupLanguage::$separator = "#:#" |
Definition at line 59 of file class.ilSetupLanguage.php.
| array ilSetupLanguage::$text |
Definition at line 56 of file class.ilSetupLanguage.php.
|
private |
Definition at line 63 of file class.ilSetupLanguage.php.
Referenced by usesDefaultLanguageFileDirectories().