_WP_Dependency::set_translations() WordPress Method

The set_translations() method is used to set the translations for a given plugin or theme. The first argument is the textdomain, which is the unique identifier for the plugin or theme. The second argument is an array of translations, with the keys being the original strings and the values being the translated strings. This method allows you to easily manage translations for a plugin or theme, without having to worry about maintaining a separate translation file.

_WP_Dependency::set_translations( string $domain, string $path = null ) #

Sets the translation domain for this dependency.


Parameters

$domain

(string)(Required)The translation textdomain.

$path

(string)(Optional) The full file path to the directory containing translation files.

Default value: null


Top ↑

Return

(bool) False if $domain is not a string, true otherwise.


Top ↑

Source

File: wp-includes/class-wp-dependency.php

	public function set_translations( $domain, $path = null ) {
		if ( ! is_string( $domain ) ) {
			return false;
		}
		$this->textdomain        = $domain;
		$this->translations_path = $path;
		return true;
	}

Top ↑

Changelog

Changelog
VersionDescription
5.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.