Polylang - Get all translations WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
Get all translations for the current language as a single key-value object.
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/k1sul1/polylang-get-all-translations/archive/refs/heads/master.zipOn Packagist as k1sul1/polylang-get-all-translations:
composer require k1sul1/polylang-get-all-translationsGet all translations for the current language as a single key-value object. Calls are cached for performance.
You can use the object in wp_localize_script() to print all string translations to the client as a JavaScript object.
pl_get_all_translations() gives you a cached array of keypairs.
There's a few filters that you can use to configure the plugin.
Requirements
- Polylang
- PHP 5.4+
Installation
Install the plugin via Composer
composer require k1sul1/polylang-get-all-translations
Activate the plugin
wp plugin activate polylang-get-all-translations
Usage
wp_enqueue_script('theme-js', get_stylesheet_directory_uri() . '/dist/js/bundle.js', false, $version, true);
wp_localize_script('theme-js', 'pll', pl_get_all_translations());Releases
4 releases.
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.