availability:

WPML Version: 3.2

description:

Outputs the UI to display a language information box in admin screens of content that was registered for translation as a string package*. It also shows the current state of any translations.

*String translation packages are registered with wpml_register_string and their translations retrieved with wpml_translate_string

Note: This hook requires the WPML String Translation module

type:
action
category:
Inserting Content
parameters:
do_action( 'wpml_show_package_language_ui', array $package, array $args )
$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:

  • kindA free text to identify the package object. Must be the same for all packages of the same type. i.e. ‘Gravity Form’ or ‘Layout’
  • nameA name to identify the set of strings with. Must be unique for each package of the same type such as an ID
  • titleA humanly readable title for the package. Must be different for each package of the same type.
  • edit_linkLink to edit this set of strings (it can be an empty string)
  • view_linkLink to view this set of strings (it can be an empty string)
$args
(array) (Optional) Arguments to control the output

  • $show_title(bool) Will hide/show the “WPML Translation” title in the box. Defaults to TRUE
  • $show_description(bool) Will hide/show the “Language of this {package_kind} is {language_name}” Defaults to TRUE
  • $show_status(bool) Will hide/show the translation status” Defaults to TRUE
  • $show_link(bool) Will hide/show the link which leads to the translation dashboard. Defaults to TRUE
  • $title_tag(string) The HTML Tag to use for the box title. Defaults to ‘h2’
  • $status_container_tag(string) The HTML Tag to use for translation status container. Defaults to ‘p’
  • $main_container_attributes(array) Array of keys->values to add to the main container (for CSS and/or js) Defaults to an empty array
  • $status_container_attributes(array) Array of keys->values to add to the status container (for CSS and/or js) Defaults to array( 'style' => 'padding-left: 10px' )
hook example usage:

Simple Example using Layouts

$package = array(
        'kind' => 'Layout',
        'name' => 'contact-us');

do_action('wpml_show_package_language_ui', $package);