{"id":19354599,"url":"https://github.com/wp-cli/i18n-command","last_synced_at":"2025-05-15T04:05:41.443Z","repository":{"id":38713278,"uuid":"111592377","full_name":"wp-cli/i18n-command","owner":"wp-cli","description":"Provides internationalization tools for WordPress projects.","archived":false,"fork":false,"pushed_at":"2025-05-12T18:26:45.000Z","size":1081,"stargazers_count":106,"open_issues_count":16,"forks_count":55,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-12T19:43:24.667Z","etag":null,"topics":["cli","hacktoberfest","i18n","localization","pot","translation","wordpress","wp-cli","wp-cli-package"],"latest_commit_sha":null,"homepage":"","language":"Gherkin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wp-cli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-11-21T19:29:57.000Z","updated_at":"2025-05-12T18:26:48.000Z","dependencies_parsed_at":"2024-01-16T17:07:59.436Z","dependency_job_id":"64b4f08a-2195-4dae-a748-a6ddb899c722","html_url":"https://github.com/wp-cli/i18n-command","commit_stats":{"total_commits":587,"total_committers":52,"mean_commits":"11.288461538461538","dds":0.7052810902896082,"last_synced_commit":"0133eb1326e7e0613315dd94c347a2a03ee6f2d4"},"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fi18n-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fi18n-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fi18n-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-cli%2Fi18n-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-cli","download_url":"https://codeload.github.com/wp-cli/i18n-command/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254270645,"owners_count":22042859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","hacktoberfest","i18n","localization","pot","translation","wordpress","wp-cli","wp-cli-package"],"created_at":"2024-11-10T05:02:45.072Z","updated_at":"2025-05-15T04:05:36.424Z","avatar_url":"https://github.com/wp-cli.png","language":"Gherkin","readme":"wp-cli/i18n-command\n===================\n\nProvides internationalization tools for WordPress projects.\n\n[![Testing](https://github.com/wp-cli/i18n-command/actions/workflows/testing.yml/badge.svg)](https://github.com/wp-cli/i18n-command/actions/workflows/testing.yml)\n\nQuick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)\n\n## Using\n\nThis package implements the following commands:\n\n### wp i18n\n\nProvides internationalization tools for WordPress projects.\n\n~~~\nwp i18n\n~~~\n\n**EXAMPLES**\n\n    # Create a POT file for the WordPress plugin/theme in the current directory\n    $ wp i18n make-pot . languages/my-plugin.pot\n\n\n\n### wp i18n make-pot\n\nCreate a POT file for a WordPress project.\n\n~~~\nwp i18n make-pot \u003csource\u003e [\u003cdestination\u003e] [--slug=\u003cslug\u003e] [--domain=\u003cdomain\u003e] [--ignore-domain] [--merge[=\u003cpaths\u003e]] [--subtract=\u003cpaths\u003e] [--subtract-and-merge] [--include=\u003cpaths\u003e] [--exclude=\u003cpaths\u003e] [--headers=\u003cheaders\u003e] [--location] [--skip-js] [--skip-php] [--skip-blade] [--skip-block-json] [--skip-theme-json] [--skip-audit] [--file-comment=\u003cfile-comment\u003e] [--package-name=\u003cname\u003e]\n~~~\n\nScans PHP, Blade-PHP and JavaScript files for translatable strings, as well as theme stylesheets and plugin files\nif the source directory is detected as either a plugin or theme.\n\n**OPTIONS**\n\n\t\u003csource\u003e\n\t\tDirectory to scan for string extraction.\n\n\t[\u003cdestination\u003e]\n\t\tName of the resulting POT file.\n\n\t[--slug=\u003cslug\u003e]\n\t\tPlugin or theme slug. Defaults to the source directory's basename.\n\n\t[--domain=\u003cdomain\u003e]\n\t\tText domain to look for in the source code, unless the `--ignore-domain` option is used.\n\t\tBy default, the \"Text Domain\" header of the plugin or theme is used.\n\t\tIf none is provided, it falls back to the project slug.\n\n\t[--ignore-domain]\n\t\tIgnore the text domain completely and extract strings with any text domain.\n\n\t[--merge[=\u003cpaths\u003e]]\n\t\tComma-separated list of POT files whose contents should be merged with the extracted strings.\n\t\tIf left empty, defaults to the destination POT file. POT file headers will be ignored.\n\n\t[--subtract=\u003cpaths\u003e]\n\t\tComma-separated list of POT files whose contents should act as some sort of denylist for string extraction.\n\t\tAny string which is found on that denylist will not be extracted.\n\t\tThis can be useful when you want to create multiple POT files from the same source directory with slightly\n\t\tdifferent content and no duplicate strings between them.\n\n\t[--subtract-and-merge]\n\t\tWhether source code references and comments from the generated POT file should be instead added to the POT file\n\t\tused for subtraction. Warning: this modifies the files passed to `--subtract`!\n\n\t[--include=\u003cpaths\u003e]\n\t\tComma-separated list of files and paths that should be used for string extraction.\n\t\tIf provided, only these files and folders will be taken into account for string extraction.\n\t\tFor example, `--include=\"src,my-file.php` will ignore anything besides `my-file.php` and files in the `src`\n\t\tdirectory. Simple glob patterns can be used, i.e. `--include=foo-*.php` includes any PHP file with the `foo-`\n\t\tprefix. Leading and trailing slashes are ignored, i.e. `/my/directory/` is the same as `my/directory`.\n\n\t[--exclude=\u003cpaths\u003e]\n\t\tComma-separated list of files and paths that should be skipped for string extraction.\n\t\tFor example, `--exclude=.github,myfile.php` would ignore any strings found within `myfile.php` or the `.github`\n\t\tfolder. Simple glob patterns can be used, i.e. `--exclude=foo-*.php` excludes any PHP file with the `foo-`\n\t\tprefix. Leading and trailing slashes are ignored, i.e. `/my/directory/` is the same as `my/directory`. The\n\t\tfollowing files and folders are always excluded: node_modules, .git, .svn, .CVS, .hg, vendor, *.min.js.\n\n\t[--headers=\u003cheaders\u003e]\n\t\tArray in JSON format of custom headers which will be added to the POT file. Defaults to empty array.\n\n\t[--location]\n\t\tWhether to write `#: filename:line` lines.\n\t\tDefaults to true, use `--no-location` to skip the removal.\n\t\tNote that disabling this option makes it harder for technically skilled translators to understand each message’s context.\n\n\t[--skip-js]\n\t\tSkips JavaScript string extraction. Useful when this is done in another build step, e.g. through Babel.\n\n\t[--skip-php]\n\t\tSkips PHP string extraction.\n\n\t[--skip-blade]\n\t\tSkips Blade-PHP string extraction.\n\n\t[--skip-block-json]\n\t\tSkips string extraction from block.json files.\n\n\t[--skip-theme-json]\n\t\tSkips string extraction from theme.json files.\n\n\t[--skip-audit]\n\t\tSkips string audit where it tries to find possible mistakes in translatable strings. Useful when running in an\n\t\tautomated environment.\n\n\t[--file-comment=\u003cfile-comment\u003e]\n\t\tString that should be added as a comment to the top of the resulting POT file.\n\t\tBy default, a copyright comment is added for WordPress plugins and themes in the following manner:\n\n     ```\n     Copyright (C) 2018 Example Plugin Author\n     This file is distributed under the same license as the Example Plugin package.\n     ```\n\n     If a plugin or theme specifies a license in their main plugin file or stylesheet, the comment looks like\n     this:\n\n     ```\n     Copyright (C) 2018 Example Plugin Author\n     This file is distributed under the GPLv2.\n     ```\n\n\t[--package-name=\u003cname\u003e]\n\t\tName to use for package name in the resulting POT file's `Project-Id-Version` header.\n\t\tOverrides plugin or theme name, if applicable.\n\n**EXAMPLES**\n\n    # Create a POT file for the WordPress plugin/theme in the current directory.\n    $ wp i18n make-pot . languages/my-plugin.pot\n\n    # Create a POT file for the continents and cities list in WordPress core.\n    $ wp i18n make-pot . continents-and-cities.pot --include=\"wp-admin/includes/continents-cities.php\" --ignore-domain\n\n    # Create a POT file for the WordPress theme in the current directory with custom headers.\n    $ wp i18n make-pot . languages/my-theme.pot --headers='{\"Report-Msgid-Bugs-To\":\"https://github.com/theme-author/my-theme/\",\"POT-Creation-Date\":\"\"}'\n\n\n\n### wp i18n make-json\n\nExtract JavaScript strings from PO files and add them to individual JSON files.\n\n~~~\nwp i18n make-json \u003csource\u003e [\u003cdestination\u003e] [--domain=\u003cdomain\u003e] [--purge] [--update-mo-files] [--pretty-print] [--use-map=\u003cpaths_or_maps\u003e]\n~~~\n\nFor JavaScript internationalization purposes, WordPress requires translations to be split up into\none Jed-formatted JSON file per JavaScript source file.\n\nSee https://make.wordpress.org/core/2018/11/09/new-javascript-i18n-support-in-wordpress/ to learn more\nabout WordPress JavaScript internationalization.\n\n**OPTIONS**\n\n\t\u003csource\u003e\n\t\tPath to an existing PO file or a directory containing multiple PO files.\n\n\t[\u003cdestination\u003e]\n\t\tPath to the destination directory for the resulting JSON files. Defaults to the source directory.\n\n\t[--domain=\u003cdomain\u003e]\n\t\tText domain to use for the JSON file name. Overrides the default one extracted from the PO file.\n\n\t[--purge]\n\t\tWhether to purge the strings that were extracted from the original source file. Defaults to true, use `--no-purge` to skip the removal.\n\n\t[--update-mo-files]\n\t\tWhether MO files should be updated as well after updating PO files.\n\t\tOnly has an effect when used in combination with `--purge`.\n\n\t[--pretty-print]\n\t\tPretty-print resulting JSON files.\n\n\t[--use-map=\u003cpaths_or_maps\u003e]\n\t\tWhether to use a mapping file for the strings, as a JSON value, array to specify multiple.\n\t\tEach element can either be a string (file path) or object (map).\n\n**EXAMPLES**\n\n    # Create JSON files for all PO files in the languages directory\n    $ wp i18n make-json languages\n\n    # Create JSON files for my-plugin-de_DE.po and leave the PO file untouched.\n    $ wp i18n make-json my-plugin-de_DE.po /tmp --no-purge\n\n    # Create JSON files with mapping\n    $ wp i18n make-json languages --use-map=build/map.json\n\n    # Create JSON files with multiple mappings\n    $ wp i18n make-json languages '--use-map=[\"build/map.json\",\"build/map2.json\"]'\n\n    # Create JSON files with object mapping\n    $ wp i18n make-json languages '--use-map={\"source/index.js\":\"build/index.js\"}'\n\n\n\n### wp i18n make-mo\n\nCreate MO files from PO files.\n\n~~~\nwp i18n make-mo \u003csource\u003e [\u003cdestination\u003e]\n~~~\n\n**OPTIONS**\n\n\t\u003csource\u003e\n\t\tPath to an existing PO file or a directory containing multiple PO files.\n\n\t[\u003cdestination\u003e]\n\t\tPath to the destination file or directory for the resulting MO files. Defaults to the source directory.\n\n**EXAMPLES**\n\n    # Create MO files for all PO files in the current directory.\n    $ wp i18n make-mo .\n\n    # Create a MO file from a single PO file in a specific directory.\n    $ wp i18n make-mo example-plugin-de_DE.po languages\n\n    # Create a MO file from a single PO file to a specific file destination\n    $ wp i18n make-mo example-plugin-de_DE.po languages/bar.mo\n\n\n\n### wp i18n make-php\n\nCreate PHP files from PO files.\n\n~~~\nwp i18n make-php \u003csource\u003e [\u003cdestination\u003e]\n~~~\n\n**OPTIONS**\n\n\t\u003csource\u003e\n\t\tPath to an existing PO file or a directory containing multiple PO files.\n\n\t[\u003cdestination\u003e]\n\t\tPath to the destination directory for the resulting PHP files. Defaults to the source directory.\n\n**EXAMPLES**\n\n    # Create PHP files for all PO files in the current directory.\n    $ wp i18n make-php .\n    Success: Created 3 files.\n\n    # Create a PHP file from a single PO file in a specific directory.\n    $ wp i18n make-php example-plugin-de_DE.po languages\n    Success: Created 1 file.\n\n\n\n### wp i18n update-po\n\nUpdate PO files from a POT file.\n\n~~~\nwp i18n update-po \u003csource\u003e [\u003cdestination\u003e]\n~~~\n\nThis behaves similarly to the [msgmerge](https://www.gnu.org/software/gettext/manual/html_node/msgmerge-Invocation.html) command.\n\n**OPTIONS**\n\n\t\u003csource\u003e\n\t\tPath to an existing POT file to use for updating.\n\n\t[\u003cdestination\u003e]\n\t\tPO file to update or a directory containing multiple PO files.\n\t\t  Defaults to all PO files in the source directory.\n\n**EXAMPLES**\n\n    # Update all PO files from a POT file in the current directory.\n    $ wp i18n update-po example-plugin.pot\n    Success: Updated 3 files.\n\n    # Update a PO file from a POT file.\n    $ wp i18n update-po example-plugin.pot example-plugin-de_DE.po\n    Success: Updated 1 file.\n\n    # Update all PO files in a given directory from a POT file.\n    $ wp i18n update-po example-plugin.pot languages\n    Success: Updated 2 files.\n\n## Installing\n\nThis package is included with WP-CLI itself, no additional installation necessary.\n\nTo install the latest version of this package over what's included in WP-CLI, run:\n\n    wp package install git@github.com:wp-cli/i18n-command.git\n\n## Contributing\n\nWe appreciate you taking the initiative to contribute to this project.\n\nContributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.\n\nFor a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.\n\n### Reporting a bug\n\nThink you’ve found a bug? We’d love for you to help us get it fixed.\n\nBefore you create a new issue, you should [search existing issues](https://github.com/wp-cli/i18n-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.\n\nOnce you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/i18n-command/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).\n\n### Creating a pull request\n\nWant to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/i18n-command/issues/new) to discuss whether the feature is a good fit for the project.\n\nOnce you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See \"[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)\" for details specific to working on this package locally.\n\n## Support\n\nGitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support\n\n\n*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Fi18n-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-cli%2Fi18n-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-cli%2Fi18n-command/lists"}