PHP Array (php)
PHP Array format stores localisation strings as associative arrays returned from .php files. This format is common in custom PHP applications and WordPress themes. The file returns a PHP array where keys are string identifiers and values are the translated strings or nested arrays for namespaced keys.
PHP locale files use the return statement to return an associative array. Keys are string identifiers. Values are either string translations or nested arrays. Interpolation typically uses sprintf-style positional placeholders or custom replacement functions defined by the application. The file is loaded via PHP's include or require and the array is used directly by the application.
Best practice: use consistent key naming across all locale files and maintain a source locale file as the definitive key list. Avoid embedding PHP logic in locale files — keep them as pure data return files. Run a CI script that compares keys across locale files to catch missing translations. Language Monster supports PHP Array format and processes the associative array structure for translation.
