Add .l10n.php syntax validation to translation workflows#208
Open
chrisdavidmiles wants to merge 1 commit intomainfrom
Open
Add .l10n.php syntax validation to translation workflows#208chrisdavidmiles wants to merge 1 commit intomainfrom
chrisdavidmiles wants to merge 1 commit intomainfrom
Conversation
…kflows wp i18n make-php generates invalid PHP when a PO file has zero translated strings — it outputs a stray comma in an empty messages array, causing a fatal parse error at runtime. This broke WP Admin for customers using non-en_US locales (PRESS0-4223). Both reusable-translations.yml and reusable-module-prep-release.yml now: 1. Auto-fix the known stray-comma pattern after i18n-ci-post / i18n runs 2. Validate all generated .l10n.php files with php -l, failing the workflow if any contain syntax errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wp i18n make-php(WP-CLI) generates invalid PHP when a PO file has zero translated strings — a stray comma in an emptymessagesarray causes a fatal parse errorreusable-translations.ymlandreusable-module-prep-release.yml:.l10n.phpfiles (workaround until WP-CLI is patched upstream)php -lon all.l10n.phpfiles and fails the workflow if any have syntax errors — prevents broken translation files from ever shipping againTest plan
.l10n.phpfile and verify the validation step catches itFixes PRESS0-4223
🤖 Generated with Claude Code