Skip to content

Add locale configuration option for WP-CLI#6208

Draft
Copilot wants to merge 10 commits intomainfrom
copilot/set-locale-for-wp-cli
Draft

Add locale configuration option for WP-CLI#6208
Copilot wants to merge 10 commits intomainfrom
copilot/set-locale-for-wp-cli

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 25, 2026

Users currently require a workaround (exec: 'global $locale; $locale="en_US";') to set the locale for WP-CLI. This adds a dedicated locale configuration option.

Changes

  • Configuration: Added locale option to config-spec.php supporting config file syntax only (not runtime flag to avoid conflicts with existing command-specific --locale parameters)
  • Implementation: Hooks WordPress locale filter in setup_bootstrap_hooks() to apply configured value early in bootstrap

Usage

Config file:

locale: de_DE

The locale value is passed directly to WordPress's locale filter without validation, allowing WordPress to handle any locale-specific processing.

Note: Runtime flag support (--locale=<locale>) was intentionally excluded to prevent conflicts with existing command-specific --locale parameters such as wp core download --locale=de_DE.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 25, 2026

Codecov Report

❌ Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
php/WP_CLI/Runner.php 0.00% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI changed the title [WIP] Set WP-CLI locale to English for better usability Add locale configuration option for WP-CLI Jan 25, 2026
Copilot AI requested a review from swissspidy January 25, 2026 17:24
Comment thread php/WP_CLI/Runner.php Outdated

This comment was marked as resolved.

Copilot AI requested a review from swissspidy January 25, 2026 17:28
@swissspidy swissspidy linked an issue Feb 4, 2026 that may be closed by this pull request
2 tasks
@swissspidy swissspidy linked an issue Feb 4, 2026 that may be closed by this pull request
@swissspidy

This comment was marked as resolved.

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:cli Related to 'cli' command command:core-language

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set locale for WP-CLI itself

2 participants