|
ILIAS
trunk Revision v13.0_alpha-62-g3b72d83f2e5
|
Compiles the messages of a migrated module into the .mo native gettext serves (see NativeGettext): the shipped state for the build (ShippedTranslationsBuild) and the overlay of local changes (MigratedLanguageFileSync), both via compileCatalog().
More...
Collaboration diagram for ILIAS\Language\ComponentTranslation\ShippedTranslations:Public Member Functions | |
| __construct (private readonly TranslationMarkupPolicy $markup_policy=new TranslationMarkupPolicy()) | |
| compile (string $shipped_po, string $module, ?callable $on_markup_violation=null, ?callable $on_invalid_plural_forms=null) | |
| The compiled catalog of $module in $shipped_po, with markers (see the class docblock). More... | |
| compileShippedCatalog (TranslationCatalog $shipped, string $module, ?callable $on_markup_violation=null, ?callable $on_invalid_plural_forms=null) | |
Static Public Member Functions | |
| static | compileCatalog (TranslationCatalog $source, string $module, bool $mark_identity, ?\Closure $value_of=null, ?callable $on_invalid_plural_forms=null) |
| The catalog native gettext serves for $module's messages in $source, see the class docblock. More... | |
Data Fields | |
| const string | PLURAL_CONTEXT = 'ilias-plural' |
| const string | IDENTITY_CONTEXT = 'ilias-identity' |
Private Member Functions | |
| sanitized (string $value, string $key, ?callable $on_markup_violation) | |
| $value cleaned by the markup policy, $on_markup_violation called for $key if anything was removed. More... | |
Compiles the messages of a migrated module into the .mo native gettext serves (see NativeGettext): the shipped state for the build (ShippedTranslationsBuild) and the overlay of local changes (MigratedLanguageFileSync), both via compileCatalog().
Layout, so txt() needs one lookup per identifier:
compile() is compileCatalog() of a shipped .po with every value cleaned by TranslationMarkupPolicy::sanitize().
Definition at line 47 of file ShippedTranslations.php.
| ILIAS\Language\ComponentTranslation\ShippedTranslations::__construct | ( | private readonly TranslationMarkupPolicy | $markup_policy = new TranslationMarkupPolicy() | ) |
Definition at line 53 of file ShippedTranslations.php.
| ILIAS\Language\ComponentTranslation\ShippedTranslations::compile | ( | string | $shipped_po, |
| string | $module, | ||
| ?callable | $on_markup_violation = null, |
||
| ?callable | $on_invalid_plural_forms = null |
||
| ) |
The compiled catalog of $module in $shipped_po, with markers (see the class docblock).
| (callable(string | $identifier, list<string> $violations): void)|null $on_markup_violation called for every cleaned value with what was removed (for a plural form with its form key, see PluralFormKey) |
| (callable(string | $message): void)|null $on_invalid_plural_forms called if there are plural messages but the "Plural-Forms" header is missing or invalid (the Germanic rule is used then) |
.mo and the value it serves for each identifier (see compileCatalog()) | RuntimeException | if $shipped_po cannot be read, parsed or compiled |
Definition at line 70 of file ShippedTranslations.php.
|
static |
The catalog native gettext serves for $module's messages in $source, see the class docblock.
Deterministic: the same messages always compile to the same bytes.
| bool | $mark_identity | whether to add the markers of messages translated as their identifier |
| ( |
Closure(string $value, string $key): string)|null $value_of what is compiled for a value (every form of a plural message with its form key, see PluralFormKey); default: the value itself
| (callable(string | $message): void)|null $on_invalid_plural_forms see compile() |
.mo and the value it serves for each identifier without context (for a plural message the value of its default form), in catalog order | RuntimeException | if the messages cannot be compiled (see TranslationCatalog::toMoString()) |
Definition at line 118 of file ShippedTranslations.php.
References ILIAS\Language\ComponentTranslation\Catalog\TranslationCatalog\setHeader().
Here is the call graph for this function:| ILIAS\Language\ComponentTranslation\ShippedTranslations::compileShippedCatalog | ( | TranslationCatalog | $shipped, |
| string | $module, | ||
| ?callable | $on_markup_violation = null, |
||
| ?callable | $on_invalid_plural_forms = null |
||
| ) |
| (callable(string | $identifier, list<string> $violations): void)|null $on_markup_violation see compile() |
| (callable(string | $message): void)|null $on_invalid_plural_forms see compile() |
| RuntimeException | if the messages cannot be compiled |
Definition at line 90 of file ShippedTranslations.php.
|
private |
$value cleaned by the markup policy, $on_markup_violation called for $key if anything was removed.
| (callable(string | $identifier, list<string> $violations): void)|null $on_markup_violation |
Definition at line 179 of file ShippedTranslations.php.
| const string ILIAS\Language\ComponentTranslation\ShippedTranslations::IDENTITY_CONTEXT = 'ilias-identity' |
Definition at line 51 of file ShippedTranslations.php.
Referenced by ILIAS\Language\ComponentTranslation\TranslationGettextRepository\getText().
| const string ILIAS\Language\ComponentTranslation\ShippedTranslations::PLURAL_CONTEXT = 'ilias-plural' |