translate()
Gets the translation of the specified text.
If the translation could not be obtained or the translation file could not be loaded, the original text will be returned.
Hooks from the function
Returns
String. Original or translated text.
Usage
translate( $text, $domain );
- $text(string) (required)
- Text to be translated.
- $domain(string)
- Translation domain (.mo file with translation).
Default: 'default'
Examples
#1 Demo
$domain = 'my-textdomain'; $text = 'Some text to translate'; echo translate( $text, $domain );
Changelog
| Since 2.2.0 | Introduced. |
| Since 5.5.0 | Introduced gettext-{$domain} filter. |