\DevOwl\MultilingualTemporaryTextDomain

Allows to set a given text domain to be translated from a .mo file.

Summary

Methods
Properties
Constants
__construct()
teardown()
gettext()
gettext_with_context()
getEntries()
getMoFile()
getLocale()
fromPluginReceiver()
fromFallbackDomain()
getTranslations()
No public properties found
No constants found
createMo()
hooks()
No protected properties found
N/A
No private methods found
$instances
$domain
$fallbackDomain
$mofile
$locale
$mo
$skipFallbackTranslation
N/A

Properties

$instances

$instances :array<mixed,\DevOwl\Multilingual\TemporaryTextDomain>

A collection of all instances with the fallback text domain as key.

This is needed to get translations in AbstractSyncPlugin also for default-POT file (in most cases English)

Type

array<mixed,\DevOwl\Multilingual\TemporaryTextDomain>

$domain

$domain :

Type

$fallbackDomain

$fallbackDomain :

Type

$mofile

$mofile :

Type

$locale

$locale :

Type

$mo

$mo :\MO

MO instance. Can be null if the given mo file is not found.

Type

\MO

$skipFallbackTranslation

$skipFallbackTranslation :

Type

Methods

__construct()

__construct(string  $domain,string  $fallbackDomain,string  $mofile,string  $locale,boolean  $skipFallbackTranslation = false)

C'tor.

Parameters

string $domain
string $fallbackDomain
string $mofile
string $locale
boolean $skipFallbackTranslation

teardown()

teardown()

Teardown the `gettext` filter.

gettext()

gettext(string  $translation,string  $text,string  $domain)

Gettext filter.

Parameters

string $translation

Translated text.

string $text

Text to translate.

string $domain

Text domain. Unique identifier for retrieving translated strings.

gettext_with_context()

gettext_with_context(string  $translation,string  $text,string  $context,string  $domain)

Gettext with context filter.

Parameters

string $translation

Translated text.

string $text

Text to translate.

string $context

Text context.

string $domain

Text domain. Unique identifier for retrieving translated strings.

getEntries()

getEntries()

Get all translation entries of the given MO file.

getMoFile()

getMoFile()

Getter.

getLocale()

getLocale()

Getter.

fromPluginReceiver()

fromPluginReceiver(string  $domain,string  $fallbackDomain,\MatthiasWeb\Utils\PluginReceiver  $receiver,\DevOwl\Multilingual\AbstractSyncPlugin  $compLanguage,string  $overrideClass = null)

Create a temporary text domain from a given WP React Starter plugin receiver.

Parameters

string $domain
string $fallbackDomain
\MatthiasWeb\Utils\PluginReceiver $receiver
\DevOwl\Multilingual\AbstractSyncPlugin $compLanguage
string $overrideClass

A class with a getPotLanguages method

fromFallbackDomain()

fromFallbackDomain(string  $fallbackDomain)

Get an instance from a given fallback domain.

Parameters

string $fallbackDomain

getTranslations()

getTranslations(string  $domain,\DevOwl\Multilingual\AbstractLanguagePlugin  $compLanguage)

Get translations for the given domain. It also searches for temporary text domains if we are e. g. in the default POT file language (in most cases English).

Parameters

string $domain
\DevOwl\Multilingual\AbstractLanguagePlugin $compLanguage

createMo()

createMo()

Create a MO instance.

hooks()

hooks()

Create `gettext` hooks.