Skip to main content

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

MethodDescription
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

NameTypeDefaultDescription
$slugstringThe 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

NameTypeDefaultDescription
$slugstringThe plugin slug.
$deprecatedstring''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

NameTypeDefaultDescription
$resultbool | arrayThe result object. Default false.
$requested_typestringThe type of translations being requested.
$argsobjectTranslation 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

NameTypeDefaultDescription
$valuemixedThe 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

NameTypeDefaultDescription
$urlstringFull 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

NameTypeDefaultDescription
$slugstringThe plugin slug.
$localestring''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

NameTypeDefaultDescription
$localestring''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

NameTypeDefaultDescription
$upgrader_objectobjectWP_Upgrader Instance.
$hook_extraarrayItem update data.

Since: 2.5.6

Source: includes/class-translationspress-updater.php:371