WPML
do_action( 'wpml_register_string', string $string_value, string $string_name, array $package, string $string_title, string $string_type )
Type
action
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

Arguments

$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) The title of the string to be displayed when editing the translation.
$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

Example usage

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

wpml_set_element_language_details, wpml_make_post_duplicates, wpml_admin_make_post_duplicates, wpml_copy_post_to_language, wpml_delete_package, wpml_import_get_trid_from_imported_translations, wpml_register_single_string, wpml_show_package_language_ui, wpml_delete_package_action

All 10 Inserting Content hooks →