Gå til hovedinnhold

PHP Content format (.php, .phpcnt)

The PHP Content format reads PHP source files and extracts the translatable text they contain — the text outside PHP code, and text within regions marked by localization directives. It is intended for PHP templates and content files where prose is interleaved with code.

Extraction can be scoped with //okapi: directives embedded as comments in the source, which turn extraction on (text) and off (skip) for regions of the file. By default these directives are honored, and text outside the directive-controlled regions is also extracted.

IDphpcontent
SourceBuilt-in
Extensions.php, .phpcnt
MIME Typesapplication/x-php
CapabilitiesRead + Write

Parameters

ParameterTypeDefaultDescription
extractOutsideDirectivesbooleantrueExtract translatable strings found outside directive-controlled regions.
useDirectivesbooleantrueHonor //okapi: skip/text directives in PHP source to control extraction scope.

Configure these parameters interactively and copy the YAML on the Format Reference.

Examples

Only directive-marked regions

Extract just the regions a translator has marked with directives.

useDirectives: true
extractOutsideDirectives: false

Processing notes

  • Translatable text becomes blocks; PHP code and structure form the non-translatable skeleton.

Limitations

  • Directive scoping relies on //okapi: comments in the source; files without them are extracted according to extractOutsideDirectives.

← Back to the Format Reference