mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
I18N: Add JavaScript translation support.
Adds the `wp_set_script_translations()` function which registers translations for a JavaScript file. This function takes a handle, domain and optionally a path and ensures JavaScript translation files are loaded if they exist. Merges [43825,43828,43859,43898] from the 5.0 branch to trunk. Props herregroen, atimmer, omarreiss, nerrad, swissspidy, ocean90, georgestephanis. Fixes #45103, #45256. git-svn-id: https://develop.svn.wordpress.org/trunk@44169 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -67,6 +67,22 @@ class _WP_Dependency {
|
||||
*/
|
||||
public $extra = array();
|
||||
|
||||
/**
|
||||
* Translation textdomain set for this dependency.
|
||||
*
|
||||
* @since 5.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $textdomain;
|
||||
|
||||
/**
|
||||
* Translation path set for this dependency.
|
||||
*
|
||||
* @since 5.0.0
|
||||
* @var string
|
||||
*/
|
||||
public $translations_path;
|
||||
|
||||
/**
|
||||
* Setup dependencies.
|
||||
*
|
||||
@@ -96,4 +112,12 @@ class _WP_Dependency {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function set_translations( $domain, $path = null ) {
|
||||
if ( ! is_string( $domain ) ) {
|
||||
return false;
|
||||
}
|
||||
$this->textdomain = $domain;
|
||||
$this->translations_path = $path;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user