[ Index ]

PHP Cross Reference of GlotPress

title

Body

[close]

/gp-includes/ -> warnings.php (summary)

Translation warnings API

File Size: 394 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

GP_Translation_Warnings:: (4 methods):
  add()
  remove()
  has()
  check()

GP_Builtin_Translation_Warnings:: (9 methods):
  warning_length()
  warning_tags()
  warning_placeholders()
  _placeholders_counts()
  warning_should_begin_on_newline()
  warning_should_not_begin_on_newline()
  warning_should_end_on_newline()
  warning_should_not_end_on_newline()
  add_all()


Class: GP_Translation_Warnings  - X-Ref

Class used to handle translation warnings.

add( $id, $callback )   X-Ref
Adds a callback for a new warning.

since: 1.0.0
param: string   $id       Unique ID of the callback.
param: callable $callback The callback.

remove( $id )   X-Ref
Removes an existing callback for a warning.

since: 1.0.0
param: string $id Unique ID of the callback.

has( $id )   X-Ref
Checks whether a callback exists for an ID.

since: 1.0.0
return: bool True if exists, false if not.
param: string $id Unique ID of the callback.

check( $singular, $plural, $translations, $locale )   X-Ref
Checks translations for any issues/warnings.

since: 1.0.0
return: array|null Null if no issues have been found, otherwise an array
param: string    $singular     The singular form of an original string.
param: string    $plural       The plural form of an original string.
param: array     $translations An array of translations for an original.
param: GP_Locale $locale       The locale of the translations.

Class: GP_Builtin_Translation_Warnings  - X-Ref

Class used to register built-in translation warnings.

warning_length( $original, $translation, $locale )   X-Ref
Checks whether lengths of source and translation differ too much.

since: 1.0.0
return: string|true True if check is OK, otherwise warning message.
param: string    $original    The source string.
param: string    $translation The translation.
param: GP_Locale $locale      The locale of the translation.

warning_tags( $original, $translation, $locale )   X-Ref
Checks whether HTML tags are missing or have been added.

since: 1.0.0
return: string|true True if check is OK, otherwise warning message.
param: string    $original    The source string.
param: string    $translation The translation.
param: GP_Locale $locale      The locale of the translation.

warning_placeholders( $original, $translation, $locale )   X-Ref
Checks whether PHP placeholders are missing or have been added.

since: 1.0.0
return: string|true True if check is OK, otherwise warning message.
param: string    $original    The source string.
param: string    $translation The translation.
param: GP_Locale $locale      The locale of the translation.

_placeholders_counts( $string, $re )   X-Ref
Counts the placeholders in a string.

since: 1.0.0
return: array An array with counts per placeholder.
param: string $string The string to search.
param: string $re     Regular expressions to match placeholders.

warning_should_begin_on_newline( $original, $translation, $locale )   X-Ref
Checks whether a translation does begin on newline.

since: 1.0.0
return: string|true True if check is OK, otherwise warning message.
param: string    $original    The source string.
param: string    $translation The translation.
param: GP_Locale $locale      The locale of the translation.

warning_should_not_begin_on_newline( $original, $translation, $locale )   X-Ref
Checks whether a translation doesn't begin on newline.

since: 1.0.0
return: string|true True if check is OK, otherwise warning message.
param: string    $original    The source string.
param: string    $translation The translation.
param: GP_Locale $locale      The locale of the translation.

warning_should_end_on_newline( $original, $translation, $locale )   X-Ref
Checks whether a translation does end on newline.

since: 1.0.0
return: string|true True if check is OK, otherwise warning message.
param: string    $original    The source string.
param: string    $translation The translation.
param: GP_Locale $locale      The locale of the translation.

warning_should_not_end_on_newline( $original, $translation, $locale )   X-Ref
Checks whether a translation doesn't end on newline.

since: 1.0.0
return: string|true True if check is OK, otherwise warning message.
param: string    $original    The source string.
param: string    $translation The translation.
param: GP_Locale $locale      The locale of the translation.

add_all( $translation_warnings )   X-Ref
Registers all methods starting with `warning_` as built-in warnings.

param: GP_Translation_Warnings $translation_warnings Instance of GP_Translation_Warnings.



Generated: Tue Jan 22 01:02:31 2019 Cross-referenced by PHPXref 0.7.1