|
ILIAS
trunk Revision v13.0_alpha-62-g3b72d83f2e5
|
TranslationRepository over the build (ShippedTranslationsBuild) with the overlay of local changes (MigratedLanguageFileSync) on top, looked up via native gettext (NativeGettext), never via the gettext/gettext library or lng_data/lng_modules. More...
Inheritance diagram for ILIAS\Language\ComponentTranslation\TranslationGettextRepository:
Collaboration diagram for ILIAS\Language\ComponentTranslation\TranslationGettextRepository:Public Member Functions | |
| getKeys (string $module, string $lang_key, ?string $client_data_dir) | |
Identifier => $module, null if $module is not served for $lang_key. More... | |
| getText (string $module, string $lang_key, string $key, ?string $client_data_dir) | |
null if there is none (not served, not translated, or a problem, see MigratedTranslations::getProblem()). More... | |
| getPluralText (string $module, string $lang_key, string $key, int $n, ?string $client_data_dir) | |
Also null if the overlay holds a singular value for $key or where getText() returns null. More... | |
| invalidateModule (string $module, string $lang_key) | |
| Forgets what was read for $module/$lang_key, so a local change just written is served. More... | |
| invalidateLanguage (string $lang_key) | |
| Forgets what was read for $lang_key (e.g. More... | |
| invalidateAll () | |
| Forgets everything read so far, see MigratedTranslations::reset(). More... | |
| getKeys (string $module, string $lang_key, ?string $client_data_dir) | |
Identifier => $module, null if $module is not served for $lang_key. More... | |
| getText (string $module, string $lang_key, string $key, ?string $client_data_dir) | |
null if there is none (not served, not translated, or a problem, see MigratedTranslations::getProblem()). More... | |
| getPluralText (string $module, string $lang_key, string $key, int $n, ?string $client_data_dir) | |
The form the plural rule of $lang_key selects for $n; null if $key is no plural message there. More... | |
Static Private Member Functions | |
| static | servedState (string $module, string $lang_key, string $key, ?string $client_data_dir) |
The state of $module/$lang_key if it is readable and lists the identifier $key, null otherwise. More... | |
| static | state (string $module, string $lang_key, ?string $client_data_dir) |
| static | withOverlay (array $state, string $client_data_dir, string $module, string $lang_key) |
$state with the overlay revision current of the overlay of $module/$lang_key names, if any. More... | |
| static | lookup (string $domain, string $message_id) |
| The translation of $message_id in. More... | |
| static | reportLostActivation () |
| static | hasSymbolicLink (array $paths) |
| static | readStart (string $file, int $length) |
At most the first $length bytes of $file, null if it cannot be read. More... | |
| static | buildKeys (string $build_directory, string $module) |
Private Attributes | |
| const int | MAX_REVISION_FILE_SIZE = 128 |
current only holds the name of a revision - more is never read. More... | |
Static Private Attributes | |
| static array | $build_keys = [] |
| static array | $states = [] |
TranslationRepository over the build (ShippedTranslationsBuild) with the overlay of local changes (MigratedLanguageFileSync) on top, looked up via native gettext (NativeGettext), never via the gettext/gettext library or lng_data/lng_modules.
A module is served for a language if the build in artifacts/language/current.json (with a system locale current-system.json) was built for it. On first use per module and language in a request (getKeys()):
<client data dir>/lang/<module>/<lang>/current names a revision, "<module>.<lang>.overlay" to it;keys/<module>.php plus the overlay revision's keys.json. getText() looks an identifier of the overlay up in the overlay domain, every other in the build's.Problems (no build, no native gettext, an unreadable catalog) go to MigratedTranslations::reportProblem(); identifiers of the module concerned are not found then. An unreadable overlay is reported and left out: the shipped values are served.
The state is static, as the domains are bound per process.
@phpstan-type State array{keys: array<string, string>, ok: bool, domain: string, overlay_domain: ?string, overlay_keys: array<string, true>, overlay_checked: bool}
Definition at line 43 of file TranslationGettextRepository.php.
|
staticprivate |
Definition at line 325 of file TranslationGettextRepository.php.
References $module, and ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\buildKeysFile().
Referenced by ILIAS\Language\ComponentTranslation\TranslationGettextRepository\state().
Here is the call graph for this function:
Here is the caller graph for this function:| ILIAS\Language\ComponentTranslation\TranslationGettextRepository::getKeys | ( | string | $module, |
| string | $lang_key, | ||
| ?string | $client_data_dir | ||
| ) |
Identifier => $module, null if $module is not served for $lang_key.
| string | null | $client_data_dir | where the local changes are looked up, none without |
Implements ILIAS\Language\ComponentTranslation\TranslationRepository.
Definition at line 64 of file TranslationGettextRepository.php.
References $module, and ILIAS\Language\ComponentTranslation\TranslationGettextRepository\state().
Here is the call graph for this function:| ILIAS\Language\ComponentTranslation\TranslationGettextRepository::getPluralText | ( | string | $module, |
| string | $lang_key, | ||
| string | $key, | ||
| int | $n, | ||
| ?string | $client_data_dir | ||
| ) |
Also null if the overlay holds a singular value for $key or where getText() returns null.
Implements ILIAS\Language\ComponentTranslation\TranslationRepository.
Definition at line 92 of file TranslationGettextRepository.php.
References $module, ILIAS\Language\ComponentTranslation\NativeGettext\isActive(), ILIAS\Language\ComponentTranslation\ShippedTranslations\PLURAL_CONTEXT, ILIAS\Language\ComponentTranslation\NativeGettext\reactivateIfLost(), ILIAS\Language\ComponentTranslation\TranslationGettextRepository\reportLostActivation(), ILIAS\Language\ComponentTranslation\TranslationGettextRepository\servedState(), and ILIAS\Language\ComponentTranslation\NativeGettext\translatePlural().
Here is the call graph for this function:| ILIAS\Language\ComponentTranslation\TranslationGettextRepository::getText | ( | string | $module, |
| string | $lang_key, | ||
| string | $key, | ||
| ?string | $client_data_dir | ||
| ) |
null if there is none (not served, not translated, or a problem, see MigratedTranslations::getProblem()).
Implements ILIAS\Language\ComponentTranslation\TranslationRepository.
Definition at line 69 of file TranslationGettextRepository.php.
References $module, ILIAS\Language\ComponentTranslation\ShippedTranslations\IDENTITY_CONTEXT, ILIAS\Language\ComponentTranslation\TranslationGettextRepository\lookup(), and ILIAS\Language\ComponentTranslation\TranslationGettextRepository\servedState().
Here is the call graph for this function:
|
staticprivate |
| list<string> | $paths |
Definition at line 294 of file TranslationGettextRepository.php.
| ILIAS\Language\ComponentTranslation\TranslationGettextRepository::invalidateAll | ( | ) |
Forgets everything read so far, see MigratedTranslations::reset().
Definition at line 137 of file TranslationGettextRepository.php.
| ILIAS\Language\ComponentTranslation\TranslationGettextRepository::invalidateLanguage | ( | string | $lang_key | ) |
Forgets what was read for $lang_key (e.g.
it was uninstalled).
Definition at line 125 of file TranslationGettextRepository.php.
| ILIAS\Language\ComponentTranslation\TranslationGettextRepository::invalidateModule | ( | string | $module, |
| string | $lang_key | ||
| ) |
Forgets what was read for $module/$lang_key, so a local change just written is served.
Definition at line 117 of file TranslationGettextRepository.php.
References $module.
|
staticprivate |
The translation of $message_id in.
$domain: null if native gettext answers with $message_id (none), false if it does not work any more (settings changed and it cannot be activated again); retried after activating it again.
Definition at line 269 of file TranslationGettextRepository.php.
References ILIAS\Language\ComponentTranslation\NativeGettext\isActive(), ILIAS\Language\ComponentTranslation\NativeGettext\reactivateIfLost(), ILIAS\Language\ComponentTranslation\TranslationGettextRepository\reportLostActivation(), and ILIAS\Language\ComponentTranslation\NativeGettext\translate().
Referenced by ILIAS\Language\ComponentTranslation\TranslationGettextRepository\getText().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
At most the first $length bytes of $file, null if it cannot be read.
Definition at line 308 of file TranslationGettextRepository.php.
Referenced by ILIAS\Language\ComponentTranslation\TranslationGettextRepository\withOverlay().
Here is the caller graph for this function:
|
staticprivate |
Definition at line 286 of file TranslationGettextRepository.php.
References ILIAS\Language\ComponentTranslation\NativeGettext\getProblem(), and ILIAS\Language\ComponentTranslation\MigratedTranslations\reportActivationProblem().
Referenced by ILIAS\Language\ComponentTranslation\TranslationGettextRepository\getPluralText(), and ILIAS\Language\ComponentTranslation\TranslationGettextRepository\lookup().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
The state of $module/$lang_key if it is readable and lists the identifier $key, null otherwise.
Definition at line 148 of file TranslationGettextRepository.php.
References $module, and ILIAS\Language\ComponentTranslation\TranslationGettextRepository\state().
Referenced by ILIAS\Language\ComponentTranslation\TranslationGettextRepository\getPluralText(), and ILIAS\Language\ComponentTranslation\TranslationGettextRepository\getText().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Definition at line 158 of file TranslationGettextRepository.php.
References $module, ILIAS\Language\ComponentTranslation\NativeGettext\activate(), ILIAS\Language\ComponentTranslation\MigratedTranslations\artifactDirectory(), ILIAS\Language\ComponentTranslation\NativeGettext\bind(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\buildDirectory(), ILIAS\Language\ComponentTranslation\TranslationGettextRepository\buildKeys(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\buildKeysFile(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\buildLocaleDirectory(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\buildMoFile(), ILIAS\Language\ComponentTranslation\NativeGettext\getProblem(), ILIAS\Language\ComponentTranslation\NativeGettext\isExtensionLoaded(), ILIAS\Language\ComponentTranslation\NativeGettext\isLoaded(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\isValidLanguageKey(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\isValidModule(), ILIAS\Language\ComponentTranslation\ShippedTranslationsBuild\platformProblem(), ILIAS\Language\ComponentTranslation\MigratedTranslations\pointer(), ILIAS\Language\ComponentTranslation\MigratedTranslations\reportActivationProblem(), ILIAS\Language\ComponentTranslation\MigratedTranslations\reportProblem(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\shippedDomain(), and ILIAS\Language\ComponentTranslation\TranslationGettextRepository\withOverlay().
Referenced by ILIAS\Language\ComponentTranslation\TranslationGettextRepository\getKeys(), and ILIAS\Language\ComponentTranslation\TranslationGettextRepository\servedState().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
$state with the overlay revision current of the overlay of $module/$lang_key names, if any.
| State | $state |
Definition at line 216 of file TranslationGettextRepository.php.
References $module, ILIAS\Language\ComponentTranslation\NativeGettext\bind(), ILIAS\Language\ComponentTranslation\NativeGettext\isLoaded(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\isOverlayRevision(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\overlayCurrentFile(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\overlayDirectory(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\overlayDomain(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\overlayKeysFile(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\overlayMoFile(), ILIAS\Language\ComponentTranslation\MigratedLanguageFilePaths\overlayRevisionDirectory(), ILIAS\Language\ComponentTranslation\TranslationGettextRepository\readStart(), and ILIAS\Language\ComponentTranslation\MigratedTranslations\reportProblem().
Referenced by ILIAS\Language\ComponentTranslation\TranslationGettextRepository\state().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Definition at line 50 of file TranslationGettextRepository.php.
|
staticprivate |
Definition at line 57 of file TranslationGettextRepository.php.
|
private |
current only holds the name of a revision - more is never read.
Definition at line 62 of file TranslationGettextRepository.php.