Scans PHP, Blade-PHP, and JavaScript files for translatable strings, as well as theme stylesheets and plugin files
if the source directory is detected as either a plugin or theme.
Param: sourceDirectory
Directory to scan for string extraction.
Param: destination
Name of the resulting POT file.
Param: slug
Plugin or theme slug. Defaults to the source directory's basename.
Param: domain
Text domain to look for in the source code,
unless the ignoreDomain option is used. By default, the "Text Domain" header of the plugin or theme is used.
If none is provided, it falls back to the project slug.
Param: ignoreDomain
Ignore the text domain completely and extract strings with any text domain.
Param: headers
Array in JSON format of custom headers which will be added to the POT file. Defaults to empty array.
Param: location
Whether to write #: filename:line lines. Defaults to true, use --no-location
to skip the removal. Note that disabling this option makes it harder for technically skilled translators
to understand each message’s context.
Param: skipJs
Skips JavaScript string extraction. Useful when this is done in another build step, e.g. through Babel.
Param: skipPhp
Skips PHP string extraction.
Param: skipBlade
Skips Blade-PHP string extraction.
Param: skipBlockJson
Skips string extraction from block.json files.
Param: skipThemeJson
Skips string extraction from theme.json files.
Param: skipAudit
Skips string audit where it tries to find possible mistakes in translatable strings.
Useful when running in an automated environment.
Param: fileComment
String that should be added as a comment to the top of the resulting POT file.
By default, a copyright comment is added for WordPress plugins and themes.
Param: packageName
Name to use for the package name in the resulting POT file's Project-Id-Version header.
Overrides the plugin or theme name, if applicable.
Create a POT file for a WordPress project.
Scans PHP, Blade-PHP, and JavaScript files for translatable strings, as well as theme stylesheets and plugin files if the source directory is detected as either a plugin or theme.
Param: sourceDirectory
Directory to scan for string extraction.
Param: destination
Name of the resulting POT file.
Param: slug
Plugin or theme slug. Defaults to the source directory's basename.
Param: domain
Text domain to look for in the source code, unless the
ignoreDomain
option is used. By default, the "Text Domain" header of the plugin or theme is used. If none is provided, it falls back to the project slug.Param: ignoreDomain
Ignore the text domain completely and extract strings with any text domain.
Param: headers
Array in JSON format of custom headers which will be added to the POT file. Defaults to empty array.
Param: location
Whether to write
#: filename:line
lines. Defaults to true, use--no-location
to skip the removal. Note that disabling this option makes it harder for technically skilled translators to understand each message’s context.Param: skipJs
Skips JavaScript string extraction. Useful when this is done in another build step, e.g. through Babel.
Param: skipPhp
Skips PHP string extraction.
Param: skipBlade
Skips Blade-PHP string extraction.
Param: skipBlockJson
Skips string extraction from block.json files.
Param: skipThemeJson
Skips string extraction from theme.json files.
Param: skipAudit
Skips string audit where it tries to find possible mistakes in translatable strings. Useful when running in an automated environment.
Param: fileComment
String that should be added as a comment to the top of the resulting POT file. By default, a copyright comment is added for WordPress plugins and themes.
Param: packageName
Name to use for the package name in the resulting POT file's
Project-Id-Version
header. Overrides the plugin or theme name, if applicable.Param: silent
Whether to hide progress information.