PHP/XHTML Static Content Parser Plugin
Plugin source location:
Plugin does full XML parsing/validation, so the document must be a XHTML/XML document with balanced tags. When it comes to PHP, these are replaced with special plain-text markers or HTML attributes to make resulting HTML valid. In case validation fails, the plugin can send an error report to specified recipients. If no email settings are provided, it will simply report the error in the console output.
By default, the following contents are extracted:
- Inner HTML of these tags:
- Values of the following attributes:
valueattribute of the
typeattribute is one of the following:
- strings inside
If the extracted candidate string for translation consists only of a PHP include, it is ignored.
In addition to implicit extraction rules listed above, one can add localization hints — special tag attributes that can adjust the string extraction
lang="en"attribute on a tag means that the entire Inner HTML of the tag needs to be extracted for translation. It also prohibits this tag to be extracted as a part of some parent tag implicit extraction rule.
lang=""attribute means that the tag's attributes and entire tag subtree should be skipped. It also prohibits this tag to be extracted as a part of some parent tag implicit extraction rule.
To control segmentation (for example, to split large paragraph into multiple separately translated sentences, one can use
<span lang="en">...</span> and
<div lang="en">...</div> wrappers.
Also, if either
data-l10n-context attribute is present in a tag, its value is used as a context for the translatable string. Similarly,
data-l10n-hint attribute can be used to specify hint for the translatable string.