LanguagesFunctions.php
Language functions.
To use these functions, it have to included "gettext/translator_functions.php" file via Translator->register()
method..
Tags
Table of Contents
Functions
- __() : string
- Translates a string.
- d__() : string
- Translates a string.
- dn__() : string
- Plural version of gettext.
- dnp__() : string
- Plural version of pgettext.
- p__() : string
- Translate with context.
- dp__() : string
- Translate with context.
- n__() : string
- Plural version of gettext.
- np__() : string
- Plural version of pgettext.
- esc__() : string
- Get translation text from `__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
- esc_d__() : string
- Get translation text from `d__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
- esc_dn__() : string
- Get translation text from `dn__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
- esc_dnp__() : string
- Get translation text from `dnp__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
- esc_dp__() : string
- Get translation text from `dp__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
- esc_n__() : string
- Get translation text from `n__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
- esc_np__() : string
- Get translation text from `np__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
- esc_p__() : string
- Get translation text from `p__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
- noop__() : string
- Noop, marks the string for translation but returns it unchanged.
Functions
__()
Translates a string.
__(string $msgid) : string
Parameters
- $msgid : string
-
String to be translated
Return values
string —translated string (or original, if not found)
d__()
Translates a string.
d__(string $domain, string $msgid) : string
Parameters
- $domain : string
-
Domain to use
- $msgid : string
-
String to be translated
Return values
string —translated string (or original, if not found)
dn__()
Plural version of gettext.
dn__(string $domain, string $msgid, string $msgidPlural, int $number) : string
Parameters
- $domain : string
-
Domain to use
- $msgid : string
-
Single form
- $msgidPlural : string
-
Plural form
- $number : int
-
Number of objects
Return values
string —translated plural form
dnp__()
Plural version of pgettext.
dnp__(string $domain, string $msgctxt, string $msgid, string $msgidPlural, int $number) : string
Parameters
- $domain : string
-
Domain to use
- $msgctxt : string
-
Context
- $msgid : string
-
Single form
- $msgidPlural : string
-
Plural form
- $number : int
-
Number of objects
Return values
string —translated plural form
p__()
Translate with context.
p__(string $msgctxt, string $msgid) : string
Parameters
- $msgctxt : string
-
Context
- $msgid : string
-
String to be translated
Return values
string —translated plural form
dp__()
Translate with context.
dp__(string $domain, string $msgctxt, string $msgid) : string
Parameters
- $domain : string
-
Domain to use
- $msgctxt : string
-
Context
- $msgid : string
-
String to be translated
Return values
string —translated plural form
n__()
Plural version of gettext.
n__(string $msgid, string $msgidPlural, int $number) : string
Parameters
- $msgid : string
-
Single form
- $msgidPlural : string
-
Plural form
- $number : int
-
Number of objects
Return values
string —translated plural form
np__()
Plural version of pgettext.
np__(string $msgctxt, string $msgid, string $msgidPlural, int $number) : string
Parameters
- $msgctxt : string
-
Context
- $msgid : string
-
Single form
- $msgidPlural : string
-
Plural form
- $number : int
-
Number of objects
Return values
string —translated plural form
esc__()
Get translation text from `__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
esc__(string $original) : string
Parameters
- $original : string
-
The message to translate.
Return values
string —Return translated text with escaped html.
esc_d__()
Get translation text from `d__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
esc_d__(string $domain, string $original) : string
Parameters
- $domain : string
-
The text domain.
- $original : string
-
The message to translate.
Return values
string —Return translated text with escaped html.
esc_dn__()
Get translation text from `dn__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
esc_dn__(string $domain, string $original, string $plural, float|int|string $value) : string
Parameters
- $domain : string
-
The text domain.
- $original : string
-
The singular message.
- $plural : string
-
The plural message.
- $value : float|int|string
-
The number (e.g. item count) to determine the translation for the respective grammatical number.
Return values
string —Return translated text with escaped html.
esc_dnp__()
Get translation text from `dnp__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
esc_dnp__(string $domain, string $context, string $original, string $plural, float|int|string $value) : string
Parameters
- $domain : string
-
The text domain.
- $context : string
-
The context message to describe what is this message about.
- $original : string
-
The singular message.
- $plural : string
-
The plural message.
- $value : float|int|string
-
The number (e.g. item count) to determine the translation for the respective grammatical number.
Return values
string —Return translated text with escaped html.
esc_dp__()
Get translation text from `dp__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
esc_dp__(string $domain, string $context, string $original) : string
Parameters
- $domain : string
-
The text domain.
- $context : string
-
The context message to describe what is this message about.
- $original : string
-
The singular message.
Return values
string —Return translated text with escaped html.
esc_n__()
Get translation text from `n__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
esc_n__(string $original, string $plural, float|int|string $value) : string
Parameters
- $original : string
-
The singular message.
- $plural : string
-
The plural message.
- $value : float|int|string
-
The number (e.g. item count) to determine the translation for the respective grammatical number.
Return values
string —Return translated text with escaped html.
esc_np__()
Get translation text from `np__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
esc_np__(string $context, string $original, string $plural, float|int|string $value) : string
Parameters
- $context : string
-
The context message to describe what is this message about.
- $original : string
-
The singular message.
- $plural : string
-
The plural message.
- $value : float|int|string
-
The number (e.g. item count) to determine the translation for the respective grammatical number.
Return values
string —Return translated text with escaped html.
esc_p__()
Get translation text from `p__()` function and then escape using `htmlspecialchars()` with `ENT_QUOTES` flag.
esc_p__(string $context, string $original) : string
Parameters
- $context : string
-
The context message to describe what is this message about.
- $original : string
-
The singular message.
Return values
string —Return translated text with escaped html.
noop__()
Noop, marks the string for translation but returns it unchanged.
noop__(string $original) : string
Parameters
- $original : string