WPML implements Registerable, Standard_Service, Conditional

Handles integration with WooCommerce Multilingual

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable
Standard_Service
Conditional

Table of Contents

$plugin  : Plugin
The plugin instance
__construct()  : void
Copnstructor
filter_admin_language_switcher_items()  : array<string|int, mixed>
Filter the admin language switcher items
get_group_package()  : array<string|int, mixed>
Create a WPML package for a group
get_string_args()  : array<string|int, mixed>
Generate an array with all the string parameters used by WPML
is_required()  : mixed
register()  : mixed
{@inheritdoc}
register_group_strings()  : void
Register group-related strings to WPML every time a group is updated.
register_option_strings()  : void
Register option-related strings to WPML every time an option is updated.
register_string()  : void
Fires the `wpml_register_string` action after creating all the parameters to register a string.
translate_string()  : string
Translate a frontend string

Properties

$plugin

The plugin instance

private Plugin $plugin
Tags

Methods

__construct()

Copnstructor

public __construct(Plugin $plugin) : void
Parameters
$plugin : Plugin

The plugin instance

Tags
Return values
void

filter_admin_language_switcher_items()

Filter the admin language switcher items

public filter_admin_language_switcher_items(array<string|int, mixed> $language_links) : array<string|int, mixed>

This function forces the language switcher items to only show the "All languages" option on the product options page. This is because the product option editor can handle all the translations at once.

Parameters
$language_links : array<string|int, mixed>

The language links

Tags
Return values
array<string|int, mixed>

get_group_package()

Create a WPML package for a group

public get_group_package(Group $group) : array<string|int, mixed>
Parameters
$group : Group

The group model

Tags
Return values
array<string|int, mixed>

The WPML package for the group

get_string_args()

Generate an array with all the string parameters used by WPML

public get_string_args(object $reference_object[, string $context = 'group_name' ][, int|null $index = null ]) : array<string|int, mixed>

This is necessary to both register a string with WPML and retrieve its translation and is unique to each plugin using the WPML integration.

Parameters
$reference_object : object

The object the string is referring to: either a Group or Option model object.

$context : string = 'group_name'

The context of the string, which designates the use of the string in the plugin.

$index : int|null = null

The index of the choice if context is choice_label.

Tags
Return values
array<string|int, mixed>

An array of arguments identifying the string in WPML.

is_required()

public is_required() : mixed
Tags
Return values
mixed

register()

{@inheritdoc}

public register() : mixed
Tags
Return values
mixed

register_group_strings()

Register group-related strings to WPML every time a group is updated.

public register_group_strings(Group $group) : void
Parameters
$group : Group

The group model

Tags
Return values
void

register_option_strings()

Register option-related strings to WPML every time an option is updated.

public register_option_strings(Option $option) : void
Parameters
$option : Option

The option model

Tags
Return values
void

register_string()

Fires the `wpml_register_string` action after creating all the parameters to register a string.

public register_string(string $string_value, object $reference_object[, string $context = 'group_name' ][, int|null $index = null ]) : void
Parameters
$string_value : string

The string value

$reference_object : object

Either a Group_Model or an Option_Model object

$context : string = 'group_name'

The context of the string

$index : int|null = null

The index of the choice if context is choice_label

Tags
Return values
void

translate_string()

Translate a frontend string

public translate_string(string $string_value, object $reference_object, string $context[, int|null $index = null ]) : string

This function registers the string with WPML and then translates it.

Parameters
$string_value : string

The frontend string

$reference_object : object

Either a Group_Model or an Option_Model object

$context : string

The context of the string

$index : int|null = null

The index of the choice if context is choice_label

Tags
Return values
string

The translated string

Search results