Class used to handle translation errors.

since 4.0.0
package GlotPress

 Methods

Registers all methods starting with `error_` as built-in errors.

add_all(\GP_Translation_Errors $translation_errors) 
since 4.0.0
access public

Parameters

$translation_errors

\GP_Translation_Errors

Instance of GP_Translation_Errors.

Adds an error for adding unexpected percent signs in a sprintf-like string.

error_unexpected_sprintf_token(string $original, string $translation) : boolean | string

This is to catch translations for originals like this:

  • Original: <a href="%s">100 percent</a>
  • Submitted translation: <a href="%s">100%</a>
  • Proper translation: <a href="%s">100%%</a>
since 4.0.0
access public

Parameters

$original

string

The original string.

$translation

string

The translated string.

Returns

booleanstring