Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/load textdomain

This page redirects to an external site: https://developer.wordpress.org/reference/functions/load_textdomain/

Description

Loads MO file into the list of domains.

If the domain already exists, the inclusion will fail. If the MO file is not readable, the inclusion will fail.

On success, the MO file will be placed in the $l10n global by $domain and will be an gettext_reader object.

Usage

<code style="color: #000000"><span style="color: #0000BB"><?php load_textdomain</span><span style="color: #007700">( </span><span style="color: #0000BB">$domain</span><span style="color: #007700">, </span><span style="color: #0000BB">$mofile </span><span style="color: #007700">) </span><span style="color: #0000BB">?></span></code>

Parameters

$domain
(string) (required) Unique identifier for retrieving translated strings
Default: None
$mofile
(string) (required) Path to the .mo file
Default: None

Return Values

(boolean) 
First, will return true and exit if call to apply_filters('override_load_textdomain') returns true. If .mo file is not readable or the import fails - returns false. Otherwise returns true.

Examples

Notes

  • Uses global: (array) $l10n. Gets list of domain translated string objects.
  • l10n is an abbreviation for localization. There are 10 characters between the initial 'l' and the terminal 'n'

Change Log

Since: 1.5.0

Source File

load_textdomain() is located in wp-includes/l10n.php.

Related

Localization: get_locale(), load_textdomain(), load_default_textdomain(), load_plugin_textdomain(), load_theme_textdomain()

See also index of Function Reference and index of Template Tags.