Skip to content

Use Relay to store WordPress translation in PHP runtime memory.

License

Notifications You must be signed in to change notification settings

cachewerk/relay-wp-l10n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Relay WordPress Localization

Use Relay to store WordPress translation in PHP runtime memory.

Installation

Install as plugin, or Must-Use plugin.

Composer installation

To install the plugin using Composer, add the repository to your composer.json:

{
  "repositories": [
    { "type": "vcs", "url": "[email protected]:cachewerk/relay-wp-l10n.git" }
  ],
}

Then simply run:

composer require cachewerk/relay-wp-l10n

Caveats

  • Translations are invalidated using FLUSHDB, be sure to set a dedicated database for translations so it won't flush the regular object cache as well

Configuration

Add the RELAY_L10N_CONFIG constant to your wp-config.php.

define('RELAY_L10N_CONFIG', [
    'host' => $_SERVER['CACHE_HOST'],
    'port' => $_SERVER['CACHE_PORT'],
    'database' => $_SERVER['CACHE_DB'] + 1,
    'password' => $_SERVER['CACHE_PASSWORD'],
] );

The default values are:

define('RELAY_L10N_CONFIG', [
    'scheme' => 'tcp',
    'host' => '127.0.0.1',
    'port' => 6379,
    'database' => 0,
    'username' => null,
    'password' => null,
    'prefix' => null,
    'timeout' => 0.5,
    'read_timeout' => 0.5,
    'backoff' => 'smart',
    'retries' => 3,
    'retry_interval' => 20,
    'tls_options' => false,
    'persistent' => false,
    'footnote' => true,
] );

About

Use Relay to store WordPress translation in PHP runtime memory.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Languages