Skip to content

I18N: Use translation-revision-date header for PHP translation files - #99

Closed
swissspidy wants to merge 1 commit into
trunkfrom
claude/cool-ptolemy-qsvrwm
Closed

swissspidy wants to merge 1 commit into
trunkfrom
claude/cool-ptolemy-qsvrwm

Conversation

@swissspidy

@swissspidy swissspidy commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

GlotPress generates .l10n.php files with a translation-revision-date header, not po-revision-date (source). Because of this mismatch, wp_get_installed_translations() returned an empty PO-Revision-Date for PHP-only translations.

This PR uses translation-revision-date throughout:

  • wp_get_l10n_php_file_data() reads PO-Revision-Date from translation-revision-date.
  • WP_Translation_File_PHP::export() renames po-revision-date to translation-revision-date. As a result, WP_Translation_File::transform( $mo, 'php' ) now produces the same header that GlotPress does.
  • WP_Translation_File_MO::export() does the reverse, so a PHP → MO conversion still writes po-revision-date.

There is no backward-compatibility handling for the old po-revision-date key in PHP files. It only matters when the .mo/.po files are missing, which should be rare.

pot-creation-date is unchanged. GlotPress doesn't emit it, so it reads as '' for GlotPress files. transform() copies headers generically, so it is carried over only when the source file has it.

Tests: the de_CH.l10n.php fixture now uses the new key. Two new tests cover MO → PHP and PHP → MO. The mo to php round-trip test now expects the rename, since example-simple.mo has a PO-Revision-Date header.

Trac ticket: https://core.trac.wordpress.org/ticket/65809

Use of AI Tools

This PR was written with Claude Code (code and tests), under the direction of and with review by the PR author. The full PHPUnit suite could not be run in the authoring environment, so the changed logic was checked with a standalone script against the real classes and fixtures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UWTd5mDonfFaS5ooNyetmH

@coderabbitai

coderabbitai Bot commented Nov 26, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@swissspidy
swissspidy force-pushed the claude/cool-ptolemy-qsvrwm branch from 6396828 to 289120a Compare November 26, 2026 14:37
GlotPress generates PHP translation files with a `translation-revision-date` header
instead of the `po-revision-date` header used in PO and MO files.

`wp_get_l10n_php_file_data()` now reads the revision date from that header,
and `WP_Translation_File::transform()` renames the header accordingly when
converting between MO and PHP files.

See #65809.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWTd5mDonfFaS5ooNyetmH
@swissspidy
swissspidy force-pushed the claude/cool-ptolemy-qsvrwm branch from 289120a to c75063f Compare November 26, 2026 14:40
@swissspidy swissspidy closed this Nov 26, 2026
@swissspidy
swissspidy deleted the claude/cool-ptolemy-qsvrwm branch December 2, 2026 10:53
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