Skip to main content
PHP locale files hold application messages in PHP array structures. Hyperlocalise supports the catalog syntax described below; use it for message resources rather than executable application logic. Supported extensions: .php.

Source file

Save this example as locales/en-US/messages.php.

Configure your files

Use this i18n.yml for the example, or add its file mapping to your existing bucket. See path templates for other layouts.

Translate

Install the CLI and set OPENAI_API_KEY in your project’s .env.local or shell. You can also configure another AI provider.
The dry run previews the work. The second command writes translations to the configured target path and updates the lockfile.

Behavior and limitations

  • Files must start with <?php and return one static [...] or array(...) literal.
  • Use quoted keys and string values. Nested arrays become dotted keys.
  • Comments, ordering, whitespace, quote style, and array syntax are preserved by replacing existing value literals.
  • Variables, function calls, constants, declare(...), and interpolated double-quoted strings are rejected.

Next steps