_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.
Contents
Parameters
- $domain
(string)(Required)The translation textdomain.
- $path
(string)(Optional) The full file path to the directory containing translation files.
Default value: null
Return
(bool) False if $domain is not a string, true otherwise.
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; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |