Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu...
File: l10n.php
*
[500] Fix | Delete
* The dynamic portion of the hook name, `$domain`, refers to the text domain.
[501] Fix | Delete
*
[502] Fix | Delete
* @since 5.5.0
[503] Fix | Delete
*
[504] Fix | Delete
* @param string $translation Translated text.
[505] Fix | Delete
* @param string $single The text to be used if the number is singular.
[506] Fix | Delete
* @param string $plural The text to be used if the number is plural.
[507] Fix | Delete
* @param int $number The number to compare against to use either the singular or plural form.
[508] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[509] Fix | Delete
*/
[510] Fix | Delete
$translation = apply_filters( "ngettext_{$domain}", $translation, $single, $plural, $number, $domain );
[511] Fix | Delete
[512] Fix | Delete
return $translation;
[513] Fix | Delete
}
[514] Fix | Delete
[515] Fix | Delete
/**
[516] Fix | Delete
* Translates and retrieves the singular or plural form based on the supplied number, with gettext context.
[517] Fix | Delete
*
[518] Fix | Delete
* This is a hybrid of _n() and _x(). It supports context and plurals.
[519] Fix | Delete
*
[520] Fix | Delete
* Used when you want to use the appropriate form of a string with context based on whether a
[521] Fix | Delete
* number is singular or plural.
[522] Fix | Delete
*
[523] Fix | Delete
* Example of a generic phrase which is disambiguated via the context parameter:
[524] Fix | Delete
*
[525] Fix | Delete
* printf( _nx( '%s group', '%s groups', $people, 'group of people', 'text-domain' ), number_format_i18n( $people ) );
[526] Fix | Delete
* printf( _nx( '%s group', '%s groups', $animals, 'group of animals', 'text-domain' ), number_format_i18n( $animals ) );
[527] Fix | Delete
*
[528] Fix | Delete
* @since 2.8.0
[529] Fix | Delete
* @since 5.5.0 Introduced `ngettext_with_context-{$domain}` filter.
[530] Fix | Delete
*
[531] Fix | Delete
* @param string $single The text to be used if the number is singular.
[532] Fix | Delete
* @param string $plural The text to be used if the number is plural.
[533] Fix | Delete
* @param int $number The number to compare against to use either the singular or plural form.
[534] Fix | Delete
* @param string $context Context information for the translators.
[535] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[536] Fix | Delete
* Default 'default'.
[537] Fix | Delete
* @return string The translated singular or plural form.
[538] Fix | Delete
*/
[539] Fix | Delete
function _nx( $single, $plural, $number, $context, $domain = 'default' ) {
[540] Fix | Delete
$translations = get_translations_for_domain( $domain );
[541] Fix | Delete
$translation = $translations->translate_plural( $single, $plural, $number, $context );
[542] Fix | Delete
[543] Fix | Delete
/**
[544] Fix | Delete
* Filters the singular or plural form of a string with gettext context.
[545] Fix | Delete
*
[546] Fix | Delete
* @since 2.8.0
[547] Fix | Delete
*
[548] Fix | Delete
* @param string $translation Translated text.
[549] Fix | Delete
* @param string $single The text to be used if the number is singular.
[550] Fix | Delete
* @param string $plural The text to be used if the number is plural.
[551] Fix | Delete
* @param int $number The number to compare against to use either the singular or plural form.
[552] Fix | Delete
* @param string $context Context information for the translators.
[553] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[554] Fix | Delete
*/
[555] Fix | Delete
$translation = apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, $domain );
[556] Fix | Delete
[557] Fix | Delete
/**
[558] Fix | Delete
* Filters the singular or plural form of a string with gettext context for a domain.
[559] Fix | Delete
*
[560] Fix | Delete
* The dynamic portion of the hook name, `$domain`, refers to the text domain.
[561] Fix | Delete
*
[562] Fix | Delete
* @since 5.5.0
[563] Fix | Delete
*
[564] Fix | Delete
* @param string $translation Translated text.
[565] Fix | Delete
* @param string $single The text to be used if the number is singular.
[566] Fix | Delete
* @param string $plural The text to be used if the number is plural.
[567] Fix | Delete
* @param int $number The number to compare against to use either the singular or plural form.
[568] Fix | Delete
* @param string $context Context information for the translators.
[569] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[570] Fix | Delete
*/
[571] Fix | Delete
$translation = apply_filters( "ngettext_with_context_{$domain}", $translation, $single, $plural, $number, $context, $domain );
[572] Fix | Delete
[573] Fix | Delete
return $translation;
[574] Fix | Delete
}
[575] Fix | Delete
[576] Fix | Delete
/**
[577] Fix | Delete
* Registers plural strings in POT file, but does not translate them.
[578] Fix | Delete
*
[579] Fix | Delete
* Used when you want to keep structures with translatable plural
[580] Fix | Delete
* strings and use them later when the number is known.
[581] Fix | Delete
*
[582] Fix | Delete
* Example:
[583] Fix | Delete
*
[584] Fix | Delete
* $message = _n_noop( '%s post', '%s posts', 'text-domain' );
[585] Fix | Delete
* ...
[586] Fix | Delete
* printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) );
[587] Fix | Delete
*
[588] Fix | Delete
* @since 2.5.0
[589] Fix | Delete
*
[590] Fix | Delete
* @param string $singular Singular form to be localized.
[591] Fix | Delete
* @param string $plural Plural form to be localized.
[592] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[593] Fix | Delete
* Default null.
[594] Fix | Delete
* @return array {
[595] Fix | Delete
* Array of translation information for the strings.
[596] Fix | Delete
*
[597] Fix | Delete
* @type string $0 Singular form to be localized. No longer used.
[598] Fix | Delete
* @type string $1 Plural form to be localized. No longer used.
[599] Fix | Delete
* @type string $singular Singular form to be localized.
[600] Fix | Delete
* @type string $plural Plural form to be localized.
[601] Fix | Delete
* @type null $context Context information for the translators.
[602] Fix | Delete
* @type string|null $domain Text domain.
[603] Fix | Delete
* }
[604] Fix | Delete
*/
[605] Fix | Delete
function _n_noop( $singular, $plural, $domain = null ) {
[606] Fix | Delete
return array(
[607] Fix | Delete
0 => $singular,
[608] Fix | Delete
1 => $plural,
[609] Fix | Delete
'singular' => $singular,
[610] Fix | Delete
'plural' => $plural,
[611] Fix | Delete
'context' => null,
[612] Fix | Delete
'domain' => $domain,
[613] Fix | Delete
);
[614] Fix | Delete
}
[615] Fix | Delete
[616] Fix | Delete
/**
[617] Fix | Delete
* Registers plural strings with gettext context in POT file, but does not translate them.
[618] Fix | Delete
*
[619] Fix | Delete
* Used when you want to keep structures with translatable plural
[620] Fix | Delete
* strings and use them later when the number is known.
[621] Fix | Delete
*
[622] Fix | Delete
* Example of a generic phrase which is disambiguated via the context parameter:
[623] Fix | Delete
*
[624] Fix | Delete
* $messages = array(
[625] Fix | Delete
* 'people' => _nx_noop( '%s group', '%s groups', 'people', 'text-domain' ),
[626] Fix | Delete
* 'animals' => _nx_noop( '%s group', '%s groups', 'animals', 'text-domain' ),
[627] Fix | Delete
* );
[628] Fix | Delete
* ...
[629] Fix | Delete
* $message = $messages[ $type ];
[630] Fix | Delete
* printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) );
[631] Fix | Delete
*
[632] Fix | Delete
* @since 2.8.0
[633] Fix | Delete
*
[634] Fix | Delete
* @param string $singular Singular form to be localized.
[635] Fix | Delete
* @param string $plural Plural form to be localized.
[636] Fix | Delete
* @param string $context Context information for the translators.
[637] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
[638] Fix | Delete
* Default null.
[639] Fix | Delete
* @return array {
[640] Fix | Delete
* Array of translation information for the strings.
[641] Fix | Delete
*
[642] Fix | Delete
* @type string $0 Singular form to be localized. No longer used.
[643] Fix | Delete
* @type string $1 Plural form to be localized. No longer used.
[644] Fix | Delete
* @type string $2 Context information for the translators. No longer used.
[645] Fix | Delete
* @type string $singular Singular form to be localized.
[646] Fix | Delete
* @type string $plural Plural form to be localized.
[647] Fix | Delete
* @type string $context Context information for the translators.
[648] Fix | Delete
* @type string|null $domain Text domain.
[649] Fix | Delete
* }
[650] Fix | Delete
*/
[651] Fix | Delete
function _nx_noop( $singular, $plural, $context, $domain = null ) {
[652] Fix | Delete
return array(
[653] Fix | Delete
0 => $singular,
[654] Fix | Delete
1 => $plural,
[655] Fix | Delete
2 => $context,
[656] Fix | Delete
'singular' => $singular,
[657] Fix | Delete
'plural' => $plural,
[658] Fix | Delete
'context' => $context,
[659] Fix | Delete
'domain' => $domain,
[660] Fix | Delete
);
[661] Fix | Delete
}
[662] Fix | Delete
[663] Fix | Delete
/**
[664] Fix | Delete
* Translates and returns the singular or plural form of a string that's been registered
[665] Fix | Delete
* with _n_noop() or _nx_noop().
[666] Fix | Delete
*
[667] Fix | Delete
* Used when you want to use a translatable plural string once the number is known.
[668] Fix | Delete
*
[669] Fix | Delete
* Example:
[670] Fix | Delete
*
[671] Fix | Delete
* $message = _n_noop( '%s post', '%s posts', 'text-domain' );
[672] Fix | Delete
* ...
[673] Fix | Delete
* printf( translate_nooped_plural( $message, $count, 'text-domain' ), number_format_i18n( $count ) );
[674] Fix | Delete
*
[675] Fix | Delete
* @since 3.1.0
[676] Fix | Delete
*
[677] Fix | Delete
* @param array $nooped_plural {
[678] Fix | Delete
* Array that is usually a return value from _n_noop() or _nx_noop().
[679] Fix | Delete
*
[680] Fix | Delete
* @type string $singular Singular form to be localized.
[681] Fix | Delete
* @type string $plural Plural form to be localized.
[682] Fix | Delete
* @type string|null $context Context information for the translators.
[683] Fix | Delete
* @type string|null $domain Text domain.
[684] Fix | Delete
* }
[685] Fix | Delete
* @param int $count Number of objects.
[686] Fix | Delete
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. If $nooped_plural contains
[687] Fix | Delete
* a text domain passed to _n_noop() or _nx_noop(), it will override this value. Default 'default'.
[688] Fix | Delete
* @return string Either $singular or $plural translated text.
[689] Fix | Delete
*/
[690] Fix | Delete
function translate_nooped_plural( $nooped_plural, $count, $domain = 'default' ) {
[691] Fix | Delete
if ( $nooped_plural['domain'] ) {
[692] Fix | Delete
$domain = $nooped_plural['domain'];
[693] Fix | Delete
}
[694] Fix | Delete
[695] Fix | Delete
if ( $nooped_plural['context'] ) {
[696] Fix | Delete
return _nx( $nooped_plural['singular'], $nooped_plural['plural'], $count, $nooped_plural['context'], $domain );
[697] Fix | Delete
} else {
[698] Fix | Delete
return _n( $nooped_plural['singular'], $nooped_plural['plural'], $count, $domain );
[699] Fix | Delete
}
[700] Fix | Delete
}
[701] Fix | Delete
[702] Fix | Delete
/**
[703] Fix | Delete
* Loads a .mo file into the text domain $domain.
[704] Fix | Delete
*
[705] Fix | Delete
* If the text domain already exists, the translations will be merged. If both
[706] Fix | Delete
* sets have the same string, the translation from the original value will be taken.
[707] Fix | Delete
*
[708] Fix | Delete
* On success, the .mo file will be placed in the $l10n global by $domain
[709] Fix | Delete
* and will be a MO object.
[710] Fix | Delete
*
[711] Fix | Delete
* @since 1.5.0
[712] Fix | Delete
* @since 6.1.0 Added the `$locale` parameter.
[713] Fix | Delete
*
[714] Fix | Delete
* @global MO[] $l10n An array of all currently loaded text domains.
[715] Fix | Delete
* @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again.
[716] Fix | Delete
* @global WP_Textdomain_Registry $wp_textdomain_registry WordPress Textdomain Registry.
[717] Fix | Delete
*
[718] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[719] Fix | Delete
* @param string $mofile Path to the .mo file.
[720] Fix | Delete
* @param string $locale Optional. Locale. Default is the current locale.
[721] Fix | Delete
* @return bool True on success, false on failure.
[722] Fix | Delete
*/
[723] Fix | Delete
function load_textdomain( $domain, $mofile, $locale = null ) {
[724] Fix | Delete
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
[725] Fix | Delete
global $l10n, $l10n_unloaded, $wp_textdomain_registry;
[726] Fix | Delete
[727] Fix | Delete
$l10n_unloaded = (array) $l10n_unloaded;
[728] Fix | Delete
[729] Fix | Delete
if ( ! is_string( $domain ) ) {
[730] Fix | Delete
return false;
[731] Fix | Delete
}
[732] Fix | Delete
[733] Fix | Delete
/**
[734] Fix | Delete
* Filters whether to short-circuit loading .mo file.
[735] Fix | Delete
*
[736] Fix | Delete
* Returning a non-null value from the filter will effectively short-circuit
[737] Fix | Delete
* the loading, returning the passed value instead.
[738] Fix | Delete
*
[739] Fix | Delete
* @since 6.3.0
[740] Fix | Delete
*
[741] Fix | Delete
* @param bool|null $loaded The result of loading a .mo file. Default null.
[742] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[743] Fix | Delete
* @param string $mofile Path to the MO file.
[744] Fix | Delete
* @param string|null $locale Locale.
[745] Fix | Delete
*/
[746] Fix | Delete
$loaded = apply_filters( 'pre_load_textdomain', null, $domain, $mofile, $locale );
[747] Fix | Delete
if ( null !== $loaded ) {
[748] Fix | Delete
if ( true === $loaded ) {
[749] Fix | Delete
unset( $l10n_unloaded[ $domain ] );
[750] Fix | Delete
}
[751] Fix | Delete
[752] Fix | Delete
return $loaded;
[753] Fix | Delete
}
[754] Fix | Delete
[755] Fix | Delete
/**
[756] Fix | Delete
* Filters whether to override the .mo file loading.
[757] Fix | Delete
*
[758] Fix | Delete
* @since 2.9.0
[759] Fix | Delete
* @since 6.2.0 Added the `$locale` parameter.
[760] Fix | Delete
*
[761] Fix | Delete
* @param bool $override Whether to override the .mo file loading. Default false.
[762] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[763] Fix | Delete
* @param string $mofile Path to the MO file.
[764] Fix | Delete
* @param string|null $locale Locale.
[765] Fix | Delete
*/
[766] Fix | Delete
$plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile, $locale );
[767] Fix | Delete
[768] Fix | Delete
if ( true === (bool) $plugin_override ) {
[769] Fix | Delete
unset( $l10n_unloaded[ $domain ] );
[770] Fix | Delete
[771] Fix | Delete
return true;
[772] Fix | Delete
}
[773] Fix | Delete
[774] Fix | Delete
/**
[775] Fix | Delete
* Fires before the MO translation file is loaded.
[776] Fix | Delete
*
[777] Fix | Delete
* @since 2.9.0
[778] Fix | Delete
*
[779] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[780] Fix | Delete
* @param string $mofile Path to the .mo file.
[781] Fix | Delete
*/
[782] Fix | Delete
do_action( 'load_textdomain', $domain, $mofile );
[783] Fix | Delete
[784] Fix | Delete
/**
[785] Fix | Delete
* Filters MO file path for loading translations for a specific text domain.
[786] Fix | Delete
*
[787] Fix | Delete
* @since 2.9.0
[788] Fix | Delete
*
[789] Fix | Delete
* @param string $mofile Path to the MO file.
[790] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[791] Fix | Delete
*/
[792] Fix | Delete
$mofile = apply_filters( 'load_textdomain_mofile', $mofile, $domain );
[793] Fix | Delete
[794] Fix | Delete
if ( ! $locale ) {
[795] Fix | Delete
$locale = determine_locale();
[796] Fix | Delete
}
[797] Fix | Delete
[798] Fix | Delete
$i18n_controller = WP_Translation_Controller::get_instance();
[799] Fix | Delete
[800] Fix | Delete
// Ensures the correct locale is set as the current one, in case it was filtered.
[801] Fix | Delete
$i18n_controller->set_locale( $locale );
[802] Fix | Delete
[803] Fix | Delete
/**
[804] Fix | Delete
* Filters the preferred file format for translation files.
[805] Fix | Delete
*
[806] Fix | Delete
* Can be used to disable the use of PHP files for translations.
[807] Fix | Delete
*
[808] Fix | Delete
* @since 6.5.0
[809] Fix | Delete
*
[810] Fix | Delete
* @param string $preferred_format Preferred file format. Possible values: 'php', 'mo'. Default: 'php'.
[811] Fix | Delete
* @param string $domain The text domain.
[812] Fix | Delete
*/
[813] Fix | Delete
$preferred_format = apply_filters( 'translation_file_format', 'php', $domain );
[814] Fix | Delete
if ( ! in_array( $preferred_format, array( 'php', 'mo' ), true ) ) {
[815] Fix | Delete
$preferred_format = 'php';
[816] Fix | Delete
}
[817] Fix | Delete
[818] Fix | Delete
$translation_files = array();
[819] Fix | Delete
[820] Fix | Delete
if ( 'mo' !== $preferred_format ) {
[821] Fix | Delete
$translation_files[] = substr_replace( $mofile, ".l10n.$preferred_format", - strlen( '.mo' ) );
[822] Fix | Delete
}
[823] Fix | Delete
[824] Fix | Delete
$translation_files[] = $mofile;
[825] Fix | Delete
[826] Fix | Delete
foreach ( $translation_files as $file ) {
[827] Fix | Delete
/**
[828] Fix | Delete
* Filters the file path for loading translations for the given text domain.
[829] Fix | Delete
*
[830] Fix | Delete
* Similar to the {@see 'load_textdomain_mofile'} filter with the difference that
[831] Fix | Delete
* the file path could be for an MO or PHP file.
[832] Fix | Delete
*
[833] Fix | Delete
* @since 6.5.0
[834] Fix | Delete
* @since 6.6.0 Added the `$locale` parameter.
[835] Fix | Delete
*
[836] Fix | Delete
* @param string $file Path to the translation file to load.
[837] Fix | Delete
* @param string $domain The text domain.
[838] Fix | Delete
* @param string $locale The locale.
[839] Fix | Delete
*/
[840] Fix | Delete
$file = (string) apply_filters( 'load_translation_file', $file, $domain, $locale );
[841] Fix | Delete
[842] Fix | Delete
$success = $i18n_controller->load_file( $file, $domain, $locale );
[843] Fix | Delete
[844] Fix | Delete
if ( $success ) {
[845] Fix | Delete
if ( isset( $l10n[ $domain ] ) && $l10n[ $domain ] instanceof MO ) {
[846] Fix | Delete
$i18n_controller->load_file( $l10n[ $domain ]->get_filename(), $domain, $locale );
[847] Fix | Delete
}
[848] Fix | Delete
[849] Fix | Delete
// Unset NOOP_Translations reference in get_translations_for_domain().
[850] Fix | Delete
unset( $l10n[ $domain ] );
[851] Fix | Delete
[852] Fix | Delete
$l10n[ $domain ] = new WP_Translations( $i18n_controller, $domain );
[853] Fix | Delete
[854] Fix | Delete
$wp_textdomain_registry->set( $domain, $locale, dirname( $file ) );
[855] Fix | Delete
[856] Fix | Delete
return true;
[857] Fix | Delete
}
[858] Fix | Delete
}
[859] Fix | Delete
[860] Fix | Delete
return false;
[861] Fix | Delete
}
[862] Fix | Delete
[863] Fix | Delete
/**
[864] Fix | Delete
* Unloads translations for a text domain.
[865] Fix | Delete
*
[866] Fix | Delete
* @since 3.0.0
[867] Fix | Delete
* @since 6.1.0 Added the `$reloadable` parameter.
[868] Fix | Delete
*
[869] Fix | Delete
* @global MO[] $l10n An array of all currently loaded text domains.
[870] Fix | Delete
* @global MO[] $l10n_unloaded An array of all text domains that have been unloaded again.
[871] Fix | Delete
*
[872] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[873] Fix | Delete
* @param bool $reloadable Whether the text domain can be loaded just-in-time again.
[874] Fix | Delete
* @return bool Whether textdomain was unloaded.
[875] Fix | Delete
*/
[876] Fix | Delete
function unload_textdomain( $domain, $reloadable = false ) {
[877] Fix | Delete
global $l10n, $l10n_unloaded;
[878] Fix | Delete
[879] Fix | Delete
$l10n_unloaded = (array) $l10n_unloaded;
[880] Fix | Delete
[881] Fix | Delete
/**
[882] Fix | Delete
* Filters whether to override the text domain unloading.
[883] Fix | Delete
*
[884] Fix | Delete
* @since 3.0.0
[885] Fix | Delete
* @since 6.1.0 Added the `$reloadable` parameter.
[886] Fix | Delete
*
[887] Fix | Delete
* @param bool $override Whether to override the text domain unloading. Default false.
[888] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[889] Fix | Delete
* @param bool $reloadable Whether the text domain can be loaded just-in-time again.
[890] Fix | Delete
*/
[891] Fix | Delete
$plugin_override = apply_filters( 'override_unload_textdomain', false, $domain, $reloadable );
[892] Fix | Delete
[893] Fix | Delete
if ( $plugin_override ) {
[894] Fix | Delete
if ( ! $reloadable ) {
[895] Fix | Delete
$l10n_unloaded[ $domain ] = true;
[896] Fix | Delete
}
[897] Fix | Delete
[898] Fix | Delete
return true;
[899] Fix | Delete
}
[900] Fix | Delete
[901] Fix | Delete
/**
[902] Fix | Delete
* Fires before the text domain is unloaded.
[903] Fix | Delete
*
[904] Fix | Delete
* @since 3.0.0
[905] Fix | Delete
* @since 6.1.0 Added the `$reloadable` parameter.
[906] Fix | Delete
*
[907] Fix | Delete
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
[908] Fix | Delete
* @param bool $reloadable Whether the text domain can be loaded just-in-time again.
[909] Fix | Delete
*/
[910] Fix | Delete
do_action( 'unload_textdomain', $domain, $reloadable );
[911] Fix | Delete
[912] Fix | Delete
// Since multiple locales are supported, reloadable text domains don't actually need to be unloaded.
[913] Fix | Delete
if ( ! $reloadable ) {
[914] Fix | Delete
WP_Translation_Controller::get_instance()->unload_textdomain( $domain );
[915] Fix | Delete
}
[916] Fix | Delete
[917] Fix | Delete
if ( isset( $l10n[ $domain ] ) ) {
[918] Fix | Delete
if ( $l10n[ $domain ] instanceof NOOP_Translations ) {
[919] Fix | Delete
unset( $l10n[ $domain ] );
[920] Fix | Delete
[921] Fix | Delete
return false;
[922] Fix | Delete
}
[923] Fix | Delete
[924] Fix | Delete
unset( $l10n[ $domain ] );
[925] Fix | Delete
[926] Fix | Delete
if ( ! $reloadable ) {
[927] Fix | Delete
$l10n_unloaded[ $domain ] = true;
[928] Fix | Delete
}
[929] Fix | Delete
[930] Fix | Delete
return true;
[931] Fix | Delete
}
[932] Fix | Delete
[933] Fix | Delete
return false;
[934] Fix | Delete
}
[935] Fix | Delete
[936] Fix | Delete
/**
[937] Fix | Delete
* Loads default translated strings based on locale.
[938] Fix | Delete
*
[939] Fix | Delete
* Loads the .mo file in WP_LANG_DIR constant path from WordPress root.
[940] Fix | Delete
* The translated (.mo) file is named based on the locale.
[941] Fix | Delete
*
[942] Fix | Delete
* @see load_textdomain()
[943] Fix | Delete
*
[944] Fix | Delete
* @since 1.5.0
[945] Fix | Delete
*
[946] Fix | Delete
* @param string $locale Optional. Locale to load. Default is the value of get_locale().
[947] Fix | Delete
* @return bool Whether the textdomain was loaded.
[948] Fix | Delete
*/
[949] Fix | Delete
function load_default_textdomain( $locale = null ) {
[950] Fix | Delete
if ( null === $locale ) {
[951] Fix | Delete
$locale = determine_locale();
[952] Fix | Delete
}
[953] Fix | Delete
[954] Fix | Delete
// Unload previously loaded strings so we can switch translations.
[955] Fix | Delete
unload_textdomain( 'default', true );
[956] Fix | Delete
[957] Fix | Delete
$return = load_textdomain( 'default', WP_LANG_DIR . "/$locale.mo", $locale );
[958] Fix | Delete
[959] Fix | Delete
if ( ( is_multisite() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) && ! file_exists( WP_LANG_DIR . "/admin-$locale.mo" ) ) {
[960] Fix | Delete
load_textdomain( 'default', WP_LANG_DIR . "/ms-$locale.mo", $locale );
[961] Fix | Delete
return $return;
[962] Fix | Delete
}
[963] Fix | Delete
[964] Fix | Delete
if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {
[965] Fix | Delete
load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
[966] Fix | Delete
}
[967] Fix | Delete
[968] Fix | Delete
if ( is_network_admin() || ( defined( 'WP_INSTALLING_NETWORK' ) && WP_INSTALLING_NETWORK ) ) {
[969] Fix | Delete
load_textdomain( 'default', WP_LANG_DIR . "/admin-network-$locale.mo", $locale );
[970] Fix | Delete
}
[971] Fix | Delete
[972] Fix | Delete
return $return;
[973] Fix | Delete
}
[974] Fix | Delete
[975] Fix | Delete
/**
[976] Fix | Delete
* Loads a plugin's translated strings.
[977] Fix | Delete
*
[978] Fix | Delete
* If the path is not given then it will be the root of the plugin directory.
[979] Fix | Delete
*
[980] Fix | Delete
* The .mo file should be named based on the text domain with a dash, and then the locale exactly.
[981] Fix | Delete
*
[982] Fix | Delete
* @since 1.5.0
[983] Fix | Delete
* @since 4.6.0 The function now tries to load the .mo file from the languages directory first.
[984] Fix | Delete
*
[985] Fix | Delete
* @param string $domain Unique identifier for retrieving translated strings
[986] Fix | Delete
* @param string|false $deprecated Optional. Deprecated. Use the $plugin_rel_path parameter instead.
[987] Fix | Delete
* Default false.
[988] Fix | Delete
* @param string|false $plugin_rel_path Optional. Relative path to WP_PLUGIN_DIR where the .mo file resides.
[989] Fix | Delete
* Default false.
[990] Fix | Delete
* @return bool True when textdomain is successfully loaded, false otherwise.
[991] Fix | Delete
*/
[992] Fix | Delete
function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) {
[993] Fix | Delete
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
[994] Fix | Delete
global $wp_textdomain_registry;
[995] Fix | Delete
[996] Fix | Delete
if ( ! is_string( $domain ) ) {
[997] Fix | Delete
return false;
[998] Fix | Delete
}
[999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function