Edit File by line
/home/barbar84/www/wp-inclu...
File: l10n.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Core Translation API
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage i18n
[5] Fix | Delete
* @since 1.2.0
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
/**
[9] Fix | Delete
* Retrieves the current locale.
[10] Fix | Delete
*
[11] Fix | Delete
* If the locale is set, then it will filter the locale in the {@see 'locale'}
[12] Fix | Delete
* filter hook and return the value.
[13] Fix | Delete
*
[14] Fix | Delete
* If the locale is not set already, then the WPLANG constant is used if it is
[15] Fix | Delete
* defined. Then it is filtered through the {@see 'locale'} filter hook and
[16] Fix | Delete
* the value for the locale global set and the locale is returned.
[17] Fix | Delete
*
[18] Fix | Delete
* The process to get the locale should only be done once, but the locale will
[19] Fix | Delete
* always be filtered using the {@see 'locale'} hook.
[20] Fix | Delete
*
[21] Fix | Delete
* @since 1.5.0
[22] Fix | Delete
*
[23] Fix | Delete
* @global string $locale The current locale.
[24] Fix | Delete
* @global string $wp_local_package Locale code of the package.
[25] Fix | Delete
*
[26] Fix | Delete
* @return string The locale of the blog or from the {@see 'locale'} hook.
[27] Fix | Delete
*/
[28] Fix | Delete
function get_locale() {
[29] Fix | Delete
global $locale, $wp_local_package;
[30] Fix | Delete
[31] Fix | Delete
if ( isset( $locale ) ) {
[32] Fix | Delete
/** This filter is documented in wp-includes/l10n.php */
[33] Fix | Delete
return apply_filters( 'locale', $locale );
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
if ( isset( $wp_local_package ) ) {
[37] Fix | Delete
$locale = $wp_local_package;
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
// WPLANG was defined in wp-config.
[41] Fix | Delete
if ( defined( 'WPLANG' ) ) {
[42] Fix | Delete
$locale = WPLANG;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
// If multisite, check options.
[46] Fix | Delete
if ( is_multisite() ) {
[47] Fix | Delete
// Don't check blog option when installing.
[48] Fix | Delete
if ( wp_installing() ) {
[49] Fix | Delete
$ms_locale = get_site_option( 'WPLANG' );
[50] Fix | Delete
} else {
[51] Fix | Delete
$ms_locale = get_option( 'WPLANG' );
[52] Fix | Delete
if ( false === $ms_locale ) {
[53] Fix | Delete
$ms_locale = get_site_option( 'WPLANG' );
[54] Fix | Delete
}
[55] Fix | Delete
}
[56] Fix | Delete
[57] Fix | Delete
if ( false !== $ms_locale ) {
[58] Fix | Delete
$locale = $ms_locale;
[59] Fix | Delete
}
[60] Fix | Delete
} else {
[61] Fix | Delete
$db_locale = get_option( 'WPLANG' );
[62] Fix | Delete
if ( false !== $db_locale ) {
[63] Fix | Delete
$locale = $db_locale;
[64] Fix | Delete
}
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
if ( empty( $locale ) ) {
[68] Fix | Delete
$locale = 'en_US';
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
/**
[72] Fix | Delete
* Filters the locale ID of the WordPress installation.
[73] Fix | Delete
*
[74] Fix | Delete
* @since 1.5.0
[75] Fix | Delete
*
[76] Fix | Delete
* @param string $locale The locale ID.
[77] Fix | Delete
*/
[78] Fix | Delete
return apply_filters( 'locale', $locale );
[79] Fix | Delete
}
[80] Fix | Delete
[81] Fix | Delete
/**
[82] Fix | Delete
* Retrieves the locale of a user.
[83] Fix | Delete
*
[84] Fix | Delete
* If the user has a locale set to a non-empty string then it will be
[85] Fix | Delete
* returned. Otherwise it returns the locale of get_locale().
[86] Fix | Delete
*
[87] Fix | Delete
* @since 4.7.0
[88] Fix | Delete
*
[89] Fix | Delete
* @param int|WP_User $user_id User's ID or a WP_User object. Defaults to current user.
[90] Fix | Delete
* @return string The locale of the user.
[91] Fix | Delete
*/
[92] Fix | Delete
function get_user_locale( $user_id = 0 ) {
[93] Fix | Delete
$user = false;
[94] Fix | Delete
if ( 0 === $user_id && function_exists( 'wp_get_current_user' ) ) {
[95] Fix | Delete
$user = wp_get_current_user();
[96] Fix | Delete
} elseif ( $user_id instanceof WP_User ) {
[97] Fix | Delete
$user = $user_id;
[98] Fix | Delete
} elseif ( $user_id && is_numeric( $user_id ) ) {
[99] Fix | Delete
$user = get_user_by( 'id', $user_id );
[100] Fix | Delete
}
[101] Fix | Delete
[102] Fix | Delete
if ( ! $user ) {
[103] Fix | Delete
return get_locale();
[104] Fix | Delete
}
[105] Fix | Delete
[106] Fix | Delete
$locale = $user->locale;
[107] Fix | Delete
return $locale ? $locale : get_locale();
[108] Fix | Delete
}
[109] Fix | Delete
[110] Fix | Delete
/**
[111] Fix | Delete
* Determine the current locale desired for the request.
[112] Fix | Delete
*
[113] Fix | Delete
* @since 5.0.0
[114] Fix | Delete
*
[115] Fix | Delete
* @global string $pagenow
[116] Fix | Delete
*
[117] Fix | Delete
* @return string The determined locale.
[118] Fix | Delete
*/
[119] Fix | Delete
function determine_locale() {
[120] Fix | Delete
/**
[121] Fix | Delete
* Filters the locale for the current request prior to the default determination process.
[122] Fix | Delete
*
[123] Fix | Delete
* Using this filter allows to override the default logic, effectively short-circuiting the function.
[124] Fix | Delete
*
[125] Fix | Delete
* @since 5.0.0
[126] Fix | Delete
*
[127] Fix | Delete
* @param string|null $locale The locale to return and short-circuit. Default null.
[128] Fix | Delete
*/
[129] Fix | Delete
$determined_locale = apply_filters( 'pre_determine_locale', null );
[130] Fix | Delete
[131] Fix | Delete
if ( ! empty( $determined_locale ) && is_string( $determined_locale ) ) {
[132] Fix | Delete
return $determined_locale;
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
$determined_locale = get_locale();
[136] Fix | Delete
[137] Fix | Delete
if ( is_admin() ) {
[138] Fix | Delete
$determined_locale = get_user_locale();
[139] Fix | Delete
}
[140] Fix | Delete
[141] Fix | Delete
if ( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() ) {
[142] Fix | Delete
$determined_locale = get_user_locale();
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
if ( ! empty( $_GET['wp_lang'] ) && ! empty( $GLOBALS['pagenow'] ) && 'wp-login.php' === $GLOBALS['pagenow'] ) {
[146] Fix | Delete
$determined_locale = sanitize_locale_name( wp_unslash( $_GET['wp_lang'] ) );
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
/**
[150] Fix | Delete
* Filters the locale for the current request.
[151] Fix | Delete
*
[152] Fix | Delete
* @since 5.0.0
[153] Fix | Delete
*
[154] Fix | Delete
* @param string $locale The locale.
[155] Fix | Delete
*/
[156] Fix | Delete
return apply_filters( 'determine_locale', $determined_locale );
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* Retrieve the translation of $text.
[161] Fix | Delete
*
[162] Fix | Delete
* If there is no translation, or the text domain isn't loaded, the original text is returned.
[163] Fix | Delete
*
[164] Fix | Delete
* *Note:* Don't use translate() directly, use __() or related functions.
[165] Fix | Delete
*
[166] Fix | Delete
* @since 2.2.0
[167] Fix | Delete
* @since 5.5.0 Introduced gettext-{$domain} filter.
[168] Fix | Delete
*
[169] Fix | Delete
* @param string $text Text to translate.
[170] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[171] Fix | Delete
* Default 'default'.
[172] Fix | Delete
* @return string Translated text.
[173] Fix | Delete
*/
[174] Fix | Delete
function translate( $text, $domain = 'default' ) {
[175] Fix | Delete
$translations = get_translations_for_domain( $domain );
[176] Fix | Delete
$translation = $translations->translate( $text );
[177] Fix | Delete
[178] Fix | Delete
/**
[179] Fix | Delete
* Filters text with its translation.
[180] Fix | Delete
*
[181] Fix | Delete
* @since 2.0.11
[182] Fix | Delete
*
[183] Fix | Delete
* @param string $translation Translated text.
[184] Fix | Delete
* @param string $text Text to translate.
[185] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[186] Fix | Delete
*/
[187] Fix | Delete
$translation = apply_filters( 'gettext', $translation, $text, $domain );
[188] Fix | Delete
[189] Fix | Delete
/**
[190] Fix | Delete
* Filters text with its translation for a domain.
[191] Fix | Delete
*
[192] Fix | Delete
* The dynamic portion of the hook, `$domain`, refers to the text domain.
[193] Fix | Delete
*
[194] Fix | Delete
* @since 5.5.0
[195] Fix | Delete
*
[196] Fix | Delete
* @param string $translation Translated text.
[197] Fix | Delete
* @param string $text Text to translate.
[198] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[199] Fix | Delete
*/
[200] Fix | Delete
$translation = apply_filters( "gettext_{$domain}", $translation, $text, $domain );
[201] Fix | Delete
[202] Fix | Delete
return $translation;
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
/**
[206] Fix | Delete
* Remove last item on a pipe-delimited string.
[207] Fix | Delete
*
[208] Fix | Delete
* Meant for removing the last item in a string, such as 'Role name|User role'. The original
[209] Fix | Delete
* string will be returned if no pipe '|' characters are found in the string.
[210] Fix | Delete
*
[211] Fix | Delete
* @since 2.8.0
[212] Fix | Delete
*
[213] Fix | Delete
* @param string $string A pipe-delimited string.
[214] Fix | Delete
* @return string Either $string or everything before the last pipe.
[215] Fix | Delete
*/
[216] Fix | Delete
function before_last_bar( $string ) {
[217] Fix | Delete
$last_bar = strrpos( $string, '|' );
[218] Fix | Delete
if ( false === $last_bar ) {
[219] Fix | Delete
return $string;
[220] Fix | Delete
} else {
[221] Fix | Delete
return substr( $string, 0, $last_bar );
[222] Fix | Delete
}
[223] Fix | Delete
}
[224] Fix | Delete
[225] Fix | Delete
/**
[226] Fix | Delete
* Retrieve the translation of $text in the context defined in $context.
[227] Fix | Delete
*
[228] Fix | Delete
* If there is no translation, or the text domain isn't loaded, the original text is returned.
[229] Fix | Delete
*
[230] Fix | Delete
* *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions.
[231] Fix | Delete
*
[232] Fix | Delete
* @since 2.8.0
[233] Fix | Delete
* @since 5.5.0 Introduced gettext_with_context-{$domain} filter.
[234] Fix | Delete
*
[235] Fix | Delete
* @param string $text Text to translate.
[236] Fix | Delete
* @param string $context Context information for the translators.
[237] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[238] Fix | Delete
* Default 'default'.
[239] Fix | Delete
* @return string Translated text on success, original text on failure.
[240] Fix | Delete
*/
[241] Fix | Delete
function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
[242] Fix | Delete
$translations = get_translations_for_domain( $domain );
[243] Fix | Delete
$translation = $translations->translate( $text, $context );
[244] Fix | Delete
[245] Fix | Delete
/**
[246] Fix | Delete
* Filters text with its translation based on context information.
[247] Fix | Delete
*
[248] Fix | Delete
* @since 2.8.0
[249] Fix | Delete
*
[250] Fix | Delete
* @param string $translation Translated text.
[251] Fix | Delete
* @param string $text Text to translate.
[252] Fix | Delete
* @param string $context Context information for the translators.
[253] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[254] Fix | Delete
*/
[255] Fix | Delete
$translation = apply_filters( 'gettext_with_context', $translation, $text, $context, $domain );
[256] Fix | Delete
[257] Fix | Delete
/**
[258] Fix | Delete
* Filters text with its translation based on context information for a domain.
[259] Fix | Delete
*
[260] Fix | Delete
* The dynamic portion of the hook, `$domain`, refers to the text domain.
[261] Fix | Delete
*
[262] Fix | Delete
* @since 5.5.0
[263] Fix | Delete
*
[264] Fix | Delete
* @param string $translation Translated text.
[265] Fix | Delete
* @param string $text Text to translate.
[266] Fix | Delete
* @param string $context Context information for the translators.
[267] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[268] Fix | Delete
*/
[269] Fix | Delete
$translation = apply_filters( "gettext_with_context_{$domain}", $translation, $text, $context, $domain );
[270] Fix | Delete
[271] Fix | Delete
return $translation;
[272] Fix | Delete
}
[273] Fix | Delete
[274] Fix | Delete
/**
[275] Fix | Delete
* Retrieve the translation of $text.
[276] Fix | Delete
*
[277] Fix | Delete
* If there is no translation, or the text domain isn't loaded, the original text is returned.
[278] Fix | Delete
*
[279] Fix | Delete
* @since 2.1.0
[280] Fix | Delete
*
[281] Fix | Delete
* @param string $text Text to translate.
[282] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[283] Fix | Delete
* Default 'default'.
[284] Fix | Delete
* @return string Translated text.
[285] Fix | Delete
*/
[286] Fix | Delete
function __( $text, $domain = 'default' ) {
[287] Fix | Delete
return translate( $text, $domain );
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
/**
[291] Fix | Delete
* Retrieve the translation of $text and escapes it for safe use in an attribute.
[292] Fix | Delete
*
[293] Fix | Delete
* If there is no translation, or the text domain isn't loaded, the original text is returned.
[294] Fix | Delete
*
[295] Fix | Delete
* @since 2.8.0
[296] Fix | Delete
*
[297] Fix | Delete
* @param string $text Text to translate.
[298] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[299] Fix | Delete
* Default 'default'.
[300] Fix | Delete
* @return string Translated text on success, original text on failure.
[301] Fix | Delete
*/
[302] Fix | Delete
function esc_attr__( $text, $domain = 'default' ) {
[303] Fix | Delete
return esc_attr( translate( $text, $domain ) );
[304] Fix | Delete
}
[305] Fix | Delete
[306] Fix | Delete
/**
[307] Fix | Delete
* Retrieve the translation of $text and escapes it for safe use in HTML output.
[308] Fix | Delete
*
[309] Fix | Delete
* If there is no translation, or the text domain isn't loaded, the original text
[310] Fix | Delete
* is escaped and returned.
[311] Fix | Delete
*
[312] Fix | Delete
* @since 2.8.0
[313] Fix | Delete
*
[314] Fix | Delete
* @param string $text Text to translate.
[315] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[316] Fix | Delete
* Default 'default'.
[317] Fix | Delete
* @return string Translated text.
[318] Fix | Delete
*/
[319] Fix | Delete
function esc_html__( $text, $domain = 'default' ) {
[320] Fix | Delete
return esc_html( translate( $text, $domain ) );
[321] Fix | Delete
}
[322] Fix | Delete
[323] Fix | Delete
/**
[324] Fix | Delete
* Display translated text.
[325] Fix | Delete
*
[326] Fix | Delete
* @since 1.2.0
[327] Fix | Delete
*
[328] Fix | Delete
* @param string $text Text to translate.
[329] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[330] Fix | Delete
* Default 'default'.
[331] Fix | Delete
*/
[332] Fix | Delete
function _e( $text, $domain = 'default' ) {
[333] Fix | Delete
echo translate( $text, $domain );
[334] Fix | Delete
}
[335] Fix | Delete
[336] Fix | Delete
/**
[337] Fix | Delete
* Display translated text that has been escaped for safe use in an attribute.
[338] Fix | Delete
*
[339] Fix | Delete
* Encodes `< > & " '` (less than, greater than, ampersand, double quote, single quote).
[340] Fix | Delete
* Will never double encode entities.
[341] Fix | Delete
*
[342] Fix | Delete
* If you need the value for use in PHP, use esc_attr__().
[343] Fix | Delete
*
[344] Fix | Delete
* @since 2.8.0
[345] Fix | Delete
*
[346] Fix | Delete
* @param string $text Text to translate.
[347] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[348] Fix | Delete
* Default 'default'.
[349] Fix | Delete
*/
[350] Fix | Delete
function esc_attr_e( $text, $domain = 'default' ) {
[351] Fix | Delete
echo esc_attr( translate( $text, $domain ) );
[352] Fix | Delete
}
[353] Fix | Delete
[354] Fix | Delete
/**
[355] Fix | Delete
* Display translated text that has been escaped for safe use in HTML output.
[356] Fix | Delete
*
[357] Fix | Delete
* If there is no translation, or the text domain isn't loaded, the original text
[358] Fix | Delete
* is escaped and displayed.
[359] Fix | Delete
*
[360] Fix | Delete
* If you need the value for use in PHP, use esc_html__().
[361] Fix | Delete
*
[362] Fix | Delete
* @since 2.8.0
[363] Fix | Delete
*
[364] Fix | Delete
* @param string $text Text to translate.
[365] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[366] Fix | Delete
* Default 'default'.
[367] Fix | Delete
*/
[368] Fix | Delete
function esc_html_e( $text, $domain = 'default' ) {
[369] Fix | Delete
echo esc_html( translate( $text, $domain ) );
[370] Fix | Delete
}
[371] Fix | Delete
[372] Fix | Delete
/**
[373] Fix | Delete
* Retrieve translated string with gettext context.
[374] Fix | Delete
*
[375] Fix | Delete
* Quite a few times, there will be collisions with similar translatable text
[376] Fix | Delete
* found in more than two places, but with different translated context.
[377] Fix | Delete
*
[378] Fix | Delete
* By including the context in the pot file, translators can translate the two
[379] Fix | Delete
* strings differently.
[380] Fix | Delete
*
[381] Fix | Delete
* @since 2.8.0
[382] Fix | Delete
*
[383] Fix | Delete
* @param string $text Text to translate.
[384] Fix | Delete
* @param string $context Context information for the translators.
[385] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[386] Fix | Delete
* Default 'default'.
[387] Fix | Delete
* @return string Translated context string without pipe.
[388] Fix | Delete
*/
[389] Fix | Delete
function _x( $text, $context, $domain = 'default' ) {
[390] Fix | Delete
return translate_with_gettext_context( $text, $context, $domain );
[391] Fix | Delete
}
[392] Fix | Delete
[393] Fix | Delete
/**
[394] Fix | Delete
* Display translated string with gettext context.
[395] Fix | Delete
*
[396] Fix | Delete
* @since 3.0.0
[397] Fix | Delete
*
[398] Fix | Delete
* @param string $text Text to translate.
[399] Fix | Delete
* @param string $context Context information for the translators.
[400] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[401] Fix | Delete
* Default 'default'.
[402] Fix | Delete
* @return string Translated context string without pipe.
[403] Fix | Delete
*/
[404] Fix | Delete
function _ex( $text, $context, $domain = 'default' ) {
[405] Fix | Delete
echo _x( $text, $context, $domain );
[406] Fix | Delete
}
[407] Fix | Delete
[408] Fix | Delete
/**
[409] Fix | Delete
* Translate string with gettext context, and escapes it for safe use in an attribute.
[410] Fix | Delete
*
[411] Fix | Delete
* If there is no translation, or the text domain isn't loaded, the original text
[412] Fix | Delete
* is escaped and returned.
[413] Fix | Delete
*
[414] Fix | Delete
* @since 2.8.0
[415] Fix | Delete
*
[416] Fix | Delete
* @param string $text Text to translate.
[417] Fix | Delete
* @param string $context Context information for the translators.
[418] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[419] Fix | Delete
* Default 'default'.
[420] Fix | Delete
* @return string Translated text.
[421] Fix | Delete
*/
[422] Fix | Delete
function esc_attr_x( $text, $context, $domain = 'default' ) {
[423] Fix | Delete
return esc_attr( translate_with_gettext_context( $text, $context, $domain ) );
[424] Fix | Delete
}
[425] Fix | Delete
[426] Fix | Delete
/**
[427] Fix | Delete
* Translate string with gettext context, and escapes it for safe use in HTML output.
[428] Fix | Delete
*
[429] Fix | Delete
* If there is no translation, or the text domain isn't loaded, the original text
[430] Fix | Delete
* is escaped and returned.
[431] Fix | Delete
*
[432] Fix | Delete
* @since 2.9.0
[433] Fix | Delete
*
[434] Fix | Delete
* @param string $text Text to translate.
[435] Fix | Delete
* @param string $context Context information for the translators.
[436] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[437] Fix | Delete
* Default 'default'.
[438] Fix | Delete
* @return string Translated text.
[439] Fix | Delete
*/
[440] Fix | Delete
function esc_html_x( $text, $context, $domain = 'default' ) {
[441] Fix | Delete
return esc_html( translate_with_gettext_context( $text, $context, $domain ) );
[442] Fix | Delete
}
[443] Fix | Delete
[444] Fix | Delete
/**
[445] Fix | Delete
* Translates and retrieves the singular or plural form based on the supplied number.
[446] Fix | Delete
*
[447] Fix | Delete
* Used when you want to use the appropriate form of a string based on whether a
[448] Fix | Delete
* number is singular or plural.
[449] Fix | Delete
*
[450] Fix | Delete
* Example:
[451] Fix | Delete
*
[452] Fix | Delete
* printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) );
[453] Fix | Delete
*
[454] Fix | Delete
* @since 2.8.0
[455] Fix | Delete
* @since 5.5.0 Introduced ngettext-{$domain} filter.
[456] Fix | Delete
*
[457] Fix | Delete
* @param string $single The text to be used if the number is singular.
[458] Fix | Delete
* @param string $plural The text to be used if the number is plural.
[459] Fix | Delete
* @param int $number The number to compare against to use either the singular or plural form.
[460] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[461] Fix | Delete
* Default 'default'.
[462] Fix | Delete
* @return string The translated singular or plural form.
[463] Fix | Delete
*/
[464] Fix | Delete
function _n( $single, $plural, $number, $domain = 'default' ) {
[465] Fix | Delete
$translations = get_translations_for_domain( $domain );
[466] Fix | Delete
$translation = $translations->translate_plural( $single, $plural, $number );
[467] Fix | Delete
[468] Fix | Delete
/**
[469] Fix | Delete
* Filters the singular or plural form of a string.
[470] Fix | Delete
*
[471] Fix | Delete
* @since 2.2.0
[472] Fix | Delete
*
[473] Fix | Delete
* @param string $translation Translated text.
[474] Fix | Delete
* @param string $single The text to be used if the number is singular.
[475] Fix | Delete
* @param string $plural The text to be used if the number is plural.
[476] Fix | Delete
* @param string $number The number to compare against to use either the singular or plural form.
[477] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[478] Fix | Delete
*/
[479] Fix | Delete
$translation = apply_filters( 'ngettext', $translation, $single, $plural, $number, $domain );
[480] Fix | Delete
[481] Fix | Delete
/**
[482] Fix | Delete
* Filters the singular or plural form of a string for a domain.
[483] Fix | Delete
*
[484] Fix | Delete
* The dynamic portion of the hook, `$domain`, refers to the text domain.
[485] Fix | Delete
*
[486] Fix | Delete
* @since 5.5.0
[487] Fix | Delete
*
[488] Fix | Delete
* @param string $translation Translated text.
[489] Fix | Delete
* @param string $single The text to be used if the number is singular.
[490] Fix | Delete
* @param string $plural The text to be used if the number is plural.
[491] Fix | Delete
* @param string $number The number to compare against to use either the singular or plural form.
[492] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[493] Fix | Delete
*/
[494] Fix | Delete
$translation = apply_filters( "ngettext_{$domain}", $translation, $single, $plural, $number, $domain );
[495] Fix | Delete
[496] Fix | Delete
return $translation;
[497] Fix | Delete
}
[498] Fix | Delete
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function