Skip to content

Commit 2462fe3

Browse files
committed
Merge branch 'main' into copilot/fix-1570774-111592377-eba74e68-167e-426d-ae73-e6330b53d3e9
2 parents 009af14 + b899eab commit 2462fe3

File tree

6 files changed

+119
-2
lines changed

6 files changed

+119
-2
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check Branch Alias
2+
3+
on:
4+
release:
5+
types: [released]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
check-branch-alias:
14+
uses: wp-cli/.github/.github/workflows/reusable-check-branch-alias.yml@main

.github/workflows/copilot-setup-steps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
steps:
1919
- name: Checkout code
20-
uses: actions/checkout@v5
20+
uses: actions/checkout@v6
2121

2222
- name: Check existence of composer.json file
2323
id: check_composer_file

.github/workflows/issue-triage.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Issue Triage
3+
4+
'on':
5+
issues:
6+
types: [opened]
7+
workflow_dispatch:
8+
inputs:
9+
issue_number:
10+
description: 'Issue number to triage (leave empty to process all)'
11+
required: false
12+
type: string
13+
14+
jobs:
15+
issue-triage:
16+
uses: wp-cli/.github/.github/workflows/reusable-issue-triage.yml@main
17+
with:
18+
issue_number: ${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Manage Labels
3+
4+
'on':
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- main
9+
- master
10+
paths:
11+
- 'composer.json'
12+
13+
permissions:
14+
issues: write
15+
contents: read
16+
17+
jobs:
18+
manage-labels:
19+
uses: wp-cli/.github/.github/workflows/reusable-manage-labels.yml@main

features/updatepo.feature

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,68 @@ Feature: Update existing PO files from a POT file
466466
"X-Domain: foo-plugin\n"
467467
"""
468468

469+
Scenario: Updates PO-Revision-Date when updating a PO file
470+
Given an empty foo-plugin directory
471+
And a foo-plugin/foo-plugin.pot file:
472+
"""
473+
# Copyright (C) 2018 Foo Plugin
474+
# This file is distributed under the same license as the Foo Plugin package.
475+
msgid ""
476+
msgstr ""
477+
"Project-Id-Version: Foo Plugin\n"
478+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
479+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
480+
"Language-Team: LANGUAGE <[email protected]>\n"
481+
"MIME-Version: 1.0\n"
482+
"Content-Type: text/plain; charset=UTF-8\n"
483+
"Content-Transfer-Encoding: 8bit\n"
484+
"POT-Creation-Date: 2023-05-02T22:06:24+00:00\n"
485+
"PO-Revision-Date: 2023-05-02T22:06:24+00:00\n"
486+
"X-Domain: foo-plugin\n"
487+
488+
#: foo-plugin.php:1
489+
msgid "Some string"
490+
msgstr ""
491+
"""
492+
And a foo-plugin/foo-plugin-de_DE.po file:
493+
"""
494+
# Copyright (C) 2018 Foo Plugin
495+
# This file is distributed under the same license as the Foo Plugin package.
496+
msgid ""
497+
msgstr ""
498+
"Project-Id-Version: Foo Plugin\n"
499+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n"
500+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
501+
"Language-Team: LANGUAGE <[email protected]>\n"
502+
"Language: de_DE\n"
503+
"MIME-Version: 1.0\n"
504+
"Content-Type: text/plain; charset=UTF-8\n"
505+
"Content-Transfer-Encoding: 8bit\n"
506+
"POT-Creation-Date: 2018-05-02T22:06:24+00:00\n"
507+
"PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
508+
"X-Domain: foo-plugin\n"
509+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
510+
511+
#: foo-plugin.php:1
512+
msgid "Some string"
513+
msgstr "Some translated string"
514+
"""
515+
516+
When I run `wp i18n update-po foo-plugin/foo-plugin.pot`
517+
Then STDOUT should be:
518+
"""
519+
Success: Updated 1 file.
520+
"""
521+
And STDERR should be empty
522+
And the foo-plugin/foo-plugin-de_DE.po file should contain:
523+
"""
524+
"PO-Revision-Date:
525+
"""
526+
And the foo-plugin/foo-plugin-de_DE.po file should not contain:
527+
"""
528+
"PO-Revision-Date: 2018-05-02T22:06:24+00:00\n"
529+
"""
530+
469531
Scenario: Keeps POT file order of translations
470532
Given an empty foo-plugin directory
471533
And a foo-plugin/foo-plugin.pot file:
@@ -516,4 +578,4 @@ Feature: Update existing PO files from a POT file
516578
Success: Updated 1 file.
517579
"""
518580
And STDERR should be empty
519-
And the contents of the foo-plugin/foo-plugin-de_DE.po file should match /First string.*Second string.*Third string/s
581+
And the contents of the foo-plugin/foo-plugin-de_DE.po file should match /First string.*Second string.*Third string/s

src/UpdatePoCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ public function __invoke( $args, $assoc_args ) {
9090
// Reorder translations to match POT file order.
9191
$ordered_translations = $this->reorder_translations( $po_translations, $pot_translations );
9292

93+
// Update PO-Revision-Date to current date and time in UTC.
94+
// Uses gmdate() for consistency across different server timezones.
95+
$po_translations->setHeader( 'PO-Revision-Date', gmdate( 'Y-m-d\TH:i:sP' ) );
96+
9397
if ( ! $ordered_translations->toPoFile( $file->getPathname() ) ) {
9498
WP_CLI::warning( sprintf( 'Could not update file %s', $file->getPathname() ) );
9599
continue;

0 commit comments

Comments
 (0)