Translator extends Component
Handles translations.
Table of Contents
- __construct() : mixed
- Class constructor.
- get_language() : string
- Gets language code.
- get_object_id() : int
- Gets translated object ID.
- get_region() : string
- Gets region code.
- get_string() : string
- Gets translation string.
- is_multilingual() : bool
- Checks multilingual status.
- register_comments() : array<string|int, mixed>
- Registers comments.
- register_options() : array<string|int, mixed>
- Registers options.
- register_post() : mixed
- Registers post.
- boot() : mixed
- Bootstraps component properties.
- set_callbacks() : mixed
- Sets the action and filter callbacks.
- set_property() : mixed
- Sets a property value.
Methods
__construct()
Class constructor.
public
__construct([array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $args : array<string|int, mixed> = []
-
Component arguments.
Return values
mixed —get_language()
Gets language code.
public
get_language() : string
Return values
string —get_object_id()
Gets translated object ID.
public
get_object_id(int $id[, string $type = 'page' ]) : int
Parameters
- $id : int
-
Object ID.
- $type : string = 'page'
-
Object type.
Return values
int —get_region()
Gets region code.
public
get_region() : string
Return values
string —get_string()
Gets translation string.
public
get_string(string $key) : string
Parameters
- $key : string
-
String key.
Return values
string —is_multilingual()
Checks multilingual status.
public
is_multilingual() : bool
Return values
bool —register_comments()
Registers comments.
public
register_comments(array<string|int, mixed> $clauses, object $query) : array<string|int, mixed>
Parameters
- $clauses : array<string|int, mixed>
-
Query clauses.
- $query : object
-
Query object.
Return values
array<string|int, mixed> —register_options()
Registers options.
public
register_options(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
-
Options.
Return values
array<string|int, mixed> —register_post()
Registers post.
public
register_post(int $post_id, string $post_type) : mixed
Parameters
- $post_id : int
-
Post ID.
- $post_type : string
-
Post type.
Return values
mixed —boot()
Bootstraps component properties.
protected
boot() : mixed
Return values
mixed —set_callbacks()
Sets the action and filter callbacks.
protected
final set_callbacks(array<string|int, mixed> $callbacks) : mixed
Parameters
- $callbacks : array<string|int, mixed>
-
Callback arguments.
Return values
mixed —set_property()
Sets a property value.
protected
final set_property(string $name, mixed $value[, string $prefix = '' ]) : mixed
Parameters
- $name : string
-
Property name.
- $value : mixed
-
Property value.
- $prefix : string = ''
-
Method prefix.