Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

wp-pot/wp-pot

Open more actions menu

wp-pot

Information

GitHub Workflow Status npm version Average time to resolve an issue Percentage of issues still open

Package wp-pot
Description Generate pot files for WordPress plugins and themes.

Like my work and want to say thanks?

Do it here:
Buy Me A Coffee

Install

npm install --save-dev wp-pot

Example usage

PHP File Parsing

const wpPot = require('wp-pot');

wpPot({
  destFile: 'file.pot',
  domain: 'domain',
  package: 'Example project',
  src: 'src/*.php'
});

JS File Parsing (only js, no jsx for now)

wpPot({
  parser: 'js',
  parserOptions: {
    ecmaVersion: 6,
  },
  src: 'test/fixtures/edge-cases.js'
});

Options

All options is optional

  • bugReport Description: Header with URL for reporting translation bugs. Type: string Default: undefined
  • commentKeyword Description: Keyword to trigger translator comment. Type: string Default: translators:
  • copyrightText Description: Copyright text Type: function|string Default: A function that takes options object as a argument and return the default copyright text.
  • domain Description: Domain to retrieve the translated text. All textdomains is included if undefined. Type: string Default: undefined
  • destFile Description: Filename for template file. Type: string Default: domain.pot or translations.pot if domain is undefined.
  • headers Description: Object containing all default headers. Set to false to not generate the default extra headers for Poedit. Type: object|bool Default: Headers used by Poedit.
  • gettextFunctions Description: Gettext functions used for finding translations. Type: object Default: WordPress translation functions.
  • includePOTCreationDate Description: Auto-populate the POT-Creation-Date header. Type: bool Default: true
  • lastTranslator Description: Name and email address of the last translator (ex: John Doe <me@example.com>). Type: string Default: undefined
  • metadataFile Description: Path to file containing plugin/theme metadata header relative to relativeTo Type: string Default: undefined
  • noFilePaths Description: Do not print out file references in pot file. Type: bool Default: false
  • package Description: Package name. Type: string Default: domain or unnamed project if domain is undefined.
  • parser Description: PHP or JS parser Type: string Default: php
  • parserOptions Description: Options for the JS parser Espree. See here. Type: object Default: { comment: true, loc: true }
  • relativeTo Description: Path to folder that file comments should be relative to. Type: string Default: destFile location or current working directory if destFile is undefined.
  • src Description: Glob or globs to match files Type: string|array Default: **/*.php
  • globOpts Description: node-glob options object to be passed through. Type: Object Default: {}
  • team Description: Name and email address of the translation team (ex: Team <team@example.com>). Type: string Default: undefined
  • writeFile Description: Write pot-file to disk. The function always returns the contents as well. Type: boolean Default: true
  • ignoreTemplateNameHeader Description: Do not extract /* Template Name: String */ headers to POT file. Type: boolean Default: false

Related

License

MIT © Rasmus Bengtsson

About

Generate pot file for WordPress plugins and themes

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.