Warning: This function has been deprecated. Use _x() instead.

translate_with_context() WordPress Function

The WordPress function translate_with_context() allows you to translate a string with a given context. This is useful for when a string can have more than one meaning, and you need to specify the context in order to correctly translate it. For example, the string "I'm going to the store" could be translated to "Voy a la tienda" in Spanish, but if the context is changed to "I'm going to the grocery store", the translation would be "Voy al supermercado".

translate_with_context( string $text, string $domain = 'default' ) #

Translates $text like translate(), but assumes that the text contains a context after its last vertical bar.


Description

Top ↑

See also


Top ↑

Parameters

$text

(string)(Required)Text to translate.

$domain

(string)(Optional)Domain to retrieve the translated text.

Default value: 'default'


Top ↑

Return

(string) Translated text.


Top ↑

Source

File: wp-includes/deprecated.php

function translate_with_context( $text, $domain = 'default' ) {
	_deprecated_function( __FUNCTION__, '2.9.0', '_x()' );
	return before_last_bar( translate( $text, $domain ) );
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Use _x()
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More