Returns the Translations instance for a text domain.
Description
If there isn’t one, returns empty Translations instance.
Parameters
$domain
stringrequired- Text domain. Unique identifier for retrieving translated strings.
Source
* @since 2.8.0
*
* @global MO[] $l10n An array of all currently loaded text domains.
*
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @return Translations|NOOP_Translations A Translations instance.
*/
function get_translations_for_domain( $domain ) {
global $l10n;
if ( isset( $l10n[ $domain ] ) || ( _load_textdomain_just_in_time( $domain ) && isset( $l10n[ $domain ] ) ) ) {
return $l10n[ $domain ];
}
static $noop_translations = null;
if ( null === $noop_translations ) {
Changelog
Version | Description |
---|---|
2.8.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.