Language: document poorly-named function parseTranslation()

This commit is contained in:
Dylan K. Taylor 2023-01-08 16:46:25 +00:00
parent 4a3d9f8f83
commit d4b8c47a65
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -183,6 +183,19 @@ class Language{
return $this->lang;
}
/**
* Replaces translation keys embedded inside a string with their raw values.
* Embedded translation keys must be prefixed by a "%" character.
*
* This is used to allow the "text" field of a Translatable to contain formatting (e.g. colour codes) and
* multiple embedded translation keys.
*
* Normal translations whose "text" is just a single translation key don't need to use this method, and can be
* processed via get() directly.
*
* @param string|null $onlyPrefix If non-null, only translation keys with this prefix will be replaced. This is
* used to allow a client to do its own translating of vanilla strings.
*/
protected function parseTranslation(string $text, ?string $onlyPrefix = null) : string{
$newString = "";