-
Notifications
You must be signed in to change notification settings - Fork 58
Add update/unchanged file reporting to update-po command #461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Copilot
wants to merge
8
commits into
main
Choose a base branch
from
copilot/fix-1570774-111592377-8d1e68ec-3eae-4dfa-abd4-ecdb9fb7198f
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d06edb0
Initial plan
Copilot ac39abd
Implement change detection for update-po command
Copilot b09b981
Simplify message formatting logic
Copilot 82e097f
Fix change detection by comparing Translation objects instead of file…
Copilot d1e2605
Fix method name: use getComments() instead of getTranslatorComments()
Copilot 46e34ad
Lint fix
swissspidy 6c5bbaf
Merge branch 'main' into copilot/fix-1570774-111592377-8d1e68ec-3eae-…
swissspidy 280cb62
Update test
swissspidy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -516,7 +516,7 @@ Feature: Update existing PO files from a POT file | |
| When I run `wp i18n update-po foo-plugin/foo-plugin.pot` | ||
| Then STDOUT should be: | ||
| """ | ||
| Success: Updated 1 file. | ||
| Success: Updated 0 files. 1 file unchanged. | ||
| """ | ||
| And STDERR should be empty | ||
| And the foo-plugin/foo-plugin-de_DE.po file should contain: | ||
|
|
@@ -527,3 +527,142 @@ Feature: Update existing PO files from a POT file | |
| """ | ||
| "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n" | ||
| """ | ||
|
|
||
| Scenario: Reports unchanged files when POT hasn't changed | ||
| Given an empty foo-plugin directory | ||
| And a foo-plugin/foo-plugin.pot file: | ||
| """ | ||
| # Copyright (C) 2018 Foo Plugin | ||
| # This file is distributed under the same license as the Foo Plugin package. | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Foo Plugin\n" | ||
| "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n" | ||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| "Language-Team: LANGUAGE <[email protected]>\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "X-Domain: foo-plugin\n" | ||
|
|
||
| #: foo-plugin.php:1 | ||
| msgid "Some string" | ||
| msgstr "" | ||
| """ | ||
| And a foo-plugin/foo-plugin-de_DE.po file: | ||
| """ | ||
| # Copyright (C) 2018 Foo Plugin | ||
| # This file is distributed under the same license as the Foo Plugin package. | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Foo Plugin\n" | ||
| "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n" | ||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| "Language-Team: LANGUAGE <[email protected]>\n" | ||
| "Language: de_DE\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "X-Domain: foo-plugin\n" | ||
| "Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
|
||
| #: foo-plugin.php:1 | ||
| msgid "Some string" | ||
| msgstr "Some translated string" | ||
| """ | ||
|
|
||
| When I run `wp i18n update-po foo-plugin/foo-plugin.pot` | ||
| Then STDOUT should be: | ||
| """ | ||
| Success: Updated 0 files. 1 file unchanged. | ||
| """ | ||
| And STDERR should be empty | ||
|
|
||
| Scenario: Reports both updated and unchanged files | ||
| Given an empty foo-plugin directory | ||
| And a foo-plugin/foo-plugin.pot file: | ||
| """ | ||
| # Copyright (C) 2018 Foo Plugin | ||
| # This file is distributed under the same license as the Foo Plugin package. | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Foo Plugin\n" | ||
| "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n" | ||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| "Language-Team: LANGUAGE <[email protected]>\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "X-Domain: foo-plugin\n" | ||
|
|
||
| #: foo-plugin.php:1 | ||
| msgid "Some string" | ||
| msgstr "" | ||
|
|
||
| #: foo-plugin.php:15 | ||
| msgid "Another new string" | ||
| msgstr "" | ||
| """ | ||
| And a foo-plugin/foo-plugin-de_DE.po file: | ||
| """ | ||
| # Copyright (C) 2018 Foo Plugin | ||
| # This file is distributed under the same license as the Foo Plugin package. | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Foo Plugin\n" | ||
| "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n" | ||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| "Language-Team: LANGUAGE <[email protected]>\n" | ||
| "Language: de_DE\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "X-Domain: foo-plugin\n" | ||
| "Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
|
||
| #: foo-plugin.php:10 | ||
| msgid "Some string" | ||
| msgstr "Some translated string" | ||
| """ | ||
| And a foo-plugin/foo-plugin-es_ES.po file: | ||
| """ | ||
| # Copyright (C) 2018 Foo Plugin | ||
| # This file is distributed under the same license as the Foo Plugin package. | ||
| msgid "" | ||
| msgstr "" | ||
| "Project-Id-Version: Foo Plugin\n" | ||
| "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/foo-plugin\n" | ||
| "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | ||
| "Language-Team: LANGUAGE <[email protected]>\n" | ||
| "Language: es_ES\n" | ||
| "MIME-Version: 1.0\n" | ||
| "Content-Type: text/plain; charset=UTF-8\n" | ||
| "Content-Transfer-Encoding: 8bit\n" | ||
| "POT-Creation-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "PO-Revision-Date: 2018-05-02T22:06:24+00:00\n" | ||
| "X-Domain: foo-plugin\n" | ||
| "Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
|
|
||
| #: foo-plugin.php:1 | ||
| msgid "Some string" | ||
| msgstr "Some translated string" | ||
|
|
||
| #: foo-plugin.php:15 | ||
| msgid "Another new string" | ||
| msgstr "Otra nueva cadena" | ||
| """ | ||
|
|
||
| When I run `wp i18n update-po foo-plugin/foo-plugin.pot` | ||
| Then STDOUT should be: | ||
| """ | ||
| Success: Updated 1 file. 1 file unchanged. | ||
swissspidy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| And STDERR should be empty | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.