Gravity_Forms\Gravity_Forms\TranslationsPress_Updater
Allows to download translations from TranslationsPress
This is a modified version of the library available at https://github.com/WP-Translations/t15s-registry This version aims to be compatible with PHP 5.2, and supports only plugins.
Since: 2.5
Source: includes/class-translationspress-updater.php:14
Details
- Kind:
class - Namespace:
Gravity_Forms\Gravity_Forms
Methods
| Method | Description |
|---|---|
get_instance() | Returns an instance of this class for the given slug. |
__construct() | Adds a new project to load translations for. |
translations_api() | Short-circuits translations API requests for private projects. |
site_transient_update_plugins() | Filters the translations transients to include the current plugin. |
refresh_all_translations() | Refreshes the cached TranslationsPress data, if expired. |
get_translations() | Gets the translations for a given project. |
download_package() | Downloads and installs the translations for the specified plugin. |
install() | Triggers translation installation, if required. |
upgrader_process_complete() | Logs which locales WordPress installs translations for. |
Method Reference
get_instance()
public static function get_instance( $slug )
Returns an instance of this class for the given slug.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$slug | string | The plugin slug. |
Returns
TranslationsPress_Updater
Since: 2.5.6
Source: includes/class-translationspress-updater.php:64
__construct()
public function __construct( $slug, $deprecated='' )
Adds a new project to load translations for.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$slug | string | The plugin slug. | |
$deprecated | string | '' | Not used. Previously, the locale to be installed. |
Since: 2.5
Source: includes/class-translationspress-updater.php:80
translations_api()
public function translations_api( $result, $requested_type, $args )
Short-circuits translations API requests for private projects.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$result | bool | array | The result object. Default false. | |
$requested_type | string | The type of translations being requested. | |
$args | object | Translation API arguments. |
Returns
bool|array
Since: 2.5
Source: includes/class-translationspress-updater.php:107
site_transient_update_plugins()
public function site_transient_update_plugins( $value )
Filters the translations transients to include the current plugin.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$value | mixed | The transient value. |
Returns
object
See Also
Since: 2.5
Source: includes/class-translationspress-updater.php:126
refresh_all_translations()
public static function refresh_all_translations()
Refreshes the cached TranslationsPress data, if expired.
Since: 2.5.6
Source: includes/class-translationspress-updater.php:173
get_translations()
public static function get_translations( $url )
Gets the translations for a given project.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$url | string | Full GlotPress API URL for the project. |
Returns
array— Translation data.
Since: 2.5
Deprecated: 2.5.6
Source: includes/class-translationspress-updater.php:243
download_package()
public static function download_package( $slug, $locale='' )
Downloads and installs the translations for the specified plugin.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$slug | string | The plugin slug. | |
$locale | string | '' | The locale when the site locale is changed or an empty string to install all the user available locales. |
Since: 2.5
Source: includes/class-translationspress-updater.php:258
install()
public function install( $locale='' )
Triggers translation installation, if required.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$locale | string | '' | The locale when the site locale is changed or an empty string to install all the user available locales. |
Since: 2.5.6
Source: includes/class-translationspress-updater.php:269
upgrader_process_complete()
public function upgrader_process_complete( $upgrader_object, $hook_extra )
Logs which locales WordPress installs translations for.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$upgrader_object | object | WP_Upgrader Instance. | |
$hook_extra | array | Item update data. |
Since: 2.5.6
Source: includes/class-translationspress-updater.php:371