Skip to content

Conversation

desrosj
Copy link
Member

@desrosj desrosj commented Aug 11, 2025

Proposed changes

This makes a few changes to the make-pot command:

  • adds the wordpress directory to the exclude list for the make-pot command: Because WordPress is installed as a Composer dependency, the strings in WordPress Core could unintentionally be included in translation files when a text domain is missing (see Avoid translating installed dependencies wp-module-help-center#218).
  • explicitly pass --domain: The default value for --domain is the project slug when Text Domain is not specified in the main plugin or theme file. Explicitly passing the text domain avoids the scenario where someone checks the repository out in a folder with a custom name.

Type of Change

Production

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update
  • Refactoring / housekeeping (changes to files not directly related to functionality)

Development

  • Tests
  • Dependency update
  • Environment update / refactoring
  • Documentation Update

Visual

Checklist

  • I have read the CONTRIBUTING doc
  • I have viewed my change in a web-browser
  • Linting and tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

This adds the `node_modules` and `wordpress` directories to the exclude list for the `make-pot` command.

Because WordPress is installed as a Composer dependency, the strings in WordPress Core could unintentionally be included in translation files when a text domain is missing.

There should not be any strings that need translating in these directories, so excluding them saves time and is more performant.
@desrosj desrosj self-assigned this Aug 11, 2025
@Copilot Copilot AI review requested due to automatic review settings August 11, 2025 14:49
@desrosj desrosj requested a review from a team as a code owner August 11, 2025 14:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines the --exclude option for the make-pot command by adding node_modules and wordpress directories to the exclusion list. This prevents WordPress Core strings from being unintentionally included in translation files when text domains are missing, improving performance and avoiding incorrect string extraction.

  • Adds node_modules and wordpress to the exclude list for the i18n pot generation command
  • Prevents inclusion of WordPress Core strings in translation files
  • Improves performance by excluding unnecessary directories during string extraction

Copy link
Contributor

github-actions bot commented Aug 11, 2025

circlecube
circlecube previously approved these changes Aug 11, 2025
Copy link
Member

@circlecube circlecube left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe vendor and node_modules are both excluded by default, but no problem to include them here too.

@desrosj
Copy link
Member Author

desrosj commented Aug 11, 2025

I believe vendor and node_modules are both excluded by default, but no problem to include them here too.

Ah yes, you're right! I think it is better to not include them. We should remove these where they are listed instead.

These are excluded by default.
@desrosj desrosj changed the title Refine the --exclude option for make-pot Refine the options passed to the make-pot command Aug 11, 2025
@desrosj desrosj merged commit 3733c19 into main Aug 11, 2025
13 of 16 checks passed
@desrosj desrosj deleted the refine/make-pot-exclusions branch August 11, 2025 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants