Skip Navigation
availability:

WPML Version: 3.2

description:

*Registers a text string for translation. The string being registered is part of a package or a group of strings (as opposed to an individual string**).

*For retrieving a “package” string translation please see: wpml_translate_string
**For registering an individual text string that does not belong to a package please see: wpml_register_single_string

Note: This hook requires the WPML String Translation module

type:
action
category:
Inserting Content
parameters:
do_action( 'wpml_register_string', string $string_value, string $string_name, array $package, string $string_title, string $string_type )
$string_value
(string) (Required) The string to register for translation
$string_name
(string) (Required) A unique name for the string
$package
(array) (Required) The package object. Array keys must match the following WPML_Package fields and will be the same for all texts sent to translation for an object:

  • kind A free text to identify the package object. Must be the same for all packages of the same type. i.e. ‘Gravity Form’ or ‘Layout’
  • name A name to identify the set of strings with. Must be unique for each package of the same type such as an ID.
  • title A humanly readable title for the package. Must be different for each package of the same type.
  • edit_link Link to edit this set of strings (it can be an empty string)
  • view_link Link to view this set of strings (it can be an empty string)
$string_title
(string) (Required) A title for the string (together with $string_name it will be used to build the name field in icl_strings table)
$string_type
(string) (Required) The string kind. Must be one of the following values:

  • AREA Anything that must contain multiple rows
  • LINE A single line value
  • VISUAL This will be shown as a WYSIWYG editor and will be handled as HTML content
hook example usage:

A complete and detailed example can be found on the “String Package Translation” documentation page.