php-joomla
The preset for Joomla. It reads INI language files and Text::_ calls.
The php-joomla preset supports the language files of Joomla.
Detection
The preset applies when composer.json requires joomla/application or joomla/cms.
x18n.config.ts
import { phpJoomla } from '@x18n/cli/presets'
import { defineConfig } from '@x18n/core'
export default defineConfig({
presets: [phpJoomla()],
})Locale files
If your config has no resources, the preset uses language/{locale}/*.ini and administrator/language/{locale}/*.ini. The ini format reads and writes these files. Keys stay flat.
language/en-GB/en-GB.com_demo.ini
COM_DEMO_TITLE="Demo"Supported syntax
In PHP files, the preset reads Text::_ and the other static methods of Text, and the legacy JText:
site/view.php
<?php echo Text::_('COM_DEMO_TITLE'); ?>Placeholders
printf: %s, %d, %1$s.
Extraction templates
| Kinds | Template |
|---|---|
| any | Text::_('{key}') |