k1sul1 / polylang-get-all-translations
New function to Polylang that prints all translations as key-value pairs.
Installs: 70
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Type:wordpress-plugin
Requires
- php: ^5.4 || ^7.0
README
Get 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());