_x

Advertisement

Summery Summery

Image for: #Summery Summery

Retrieve translated string with gettext context.

Syntax Syntax

Image for: #Syntax Syntax
_x( string $text, string $context, string $domain = 'default' )

Description Description

Image for: #Description Description

Quite a few times, there will be collisions with similar translatable text found in more than two places, but with different translated context.

By including the context in the pot file, translators can translate the two strings differently.

Parameters Parameters

Image for: #Parameters Parameters
$text

(Required) Text to translate.

$context

(Required) Context information for the translators.

$domain

(Optional) Text domain. Unique identifier for retrieving translated strings. Default 'default'.

Default value: 'default'

Return Return

Image for: #Return Return

(string) Translated context string without pipe.

Source Source

Image for: #Source Source

File: wp-includes/l10n.php

/**
 * Display translated text that has been escaped for safe use in HTML output.
 *

Advertisement

Changelog Changelog

Image for: #Changelog Changelog
Changelog
VersionDescription
2.8.0Introduced.
Image for: #Related Related

Advertisement

Leave a Reply