Jet\Translator_Dictionary_Phrase
This class represents a phrase - a single entry in a dictionary translator. In normal use of translators, you won't encounter this class because the entire compiler is used via the facade - Jet\Translator (Jet\Tr) class. However, you need to know the class if you want to dig into the compiler properly and, for example, create your own backend.
Overview of methods
Method | Meaning of |
---|---|
public __construct( string $phrase, string $translation = '', bool $is_translated = false, string|null $hash = null ) |
Parameters:
|
public getPhrase( ): string |
Returns the phrase (text to be translated). |
public getHash( ): string |
Returns the internal hash of the phrase. |
public getIsTranslated( ): bool |
Indicates whether it is/is not translated. |
public setIsTranslated( bool $is_translated ): void |
Sets whether it is/is not translated. |
public getTranslation( ): string |
Returns the translation to the target localization. If the phrase is not translated, it returns the original phrase. |
public setTranslation( string $translation ): void |
Sets the translation to the target localization. |
public getTranslationRaw( ): string |
Returns the current form of the translation regardless of whether the phrase is marked as translated or not. |
public removePhrase( Translator_Dictionary_Phrase $phrase, bool $save_required = true ): void |
Removes the phase from the dictionary and determines whether the dictionary needs to be resaved. |