Class used to handle translation warnings.

since 1.0.0
package GlotPress

 Methods

Adds a callback for a new warning.

add(string $id, callable $callback) 
since 1.0.0
access public

Parameters

$id

string

Unique ID of the callback.

$callback

callable

The callback.

Checks translations for any issues/warnings.

check(string $singular, string $plural, array $translations, \GP_Locale $locale) : array | null
since 1.0.0
access public

Parameters

$singular

string

The singular form of an original string.

$plural

string

The plural form of an original string.

$translations

array

An array of translations for an original.

$locale

\GP_Locale

The locale of the translations.

Returns

arraynullNull if no issues have been found, otherwise an array with warnings.

Checks whether a callback exists for an ID.

has(string $id) : boolean
since 1.0.0
access public

Parameters

$id

string

Unique ID of the callback.

Returns

booleanTrue if exists, false if not.

Removes an existing callback for a warning.

remove(string $id) 
since 1.0.0
access public

Parameters

$id

string

Unique ID of the callback.

 Properties

 

List of callbacks.

$callbacks : array

Default

array()
since 1.0.0
access public