Skip to content
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

update-po: Preserve unused translations/comments? #334

Open
1 task done
strarsis opened this issue Jul 18, 2022 · 1 comment
Open
1 task done

update-po: Preserve unused translations/comments? #334

strarsis opened this issue Jul 18, 2022 · 1 comment

Comments

@strarsis
Copy link
Contributor

Feature Request

Describe your use case and the problem you are facing
update-po doesn't preserve unused translations/comments inside the PO files.
As Gettext editors like POEdit use their own translation database and VCS are usually used, this isn't a big deal and may de-clutter the PO file. - But an option for keeping this extra stuff may still be helpful in some cases.

Describe the solution you'd like
An option that lets update-po keep the unused translations/comments inside the PO files.

Example:
Input PO:

# Copyright (C) 2022 ACME
# This file is distributed under the proprietary.
msgid ""
msgstr ""
"Project-Id-Version: Test Theme 1.0.0\n"
[...]

#: theme.json
msgctxt "Color name"
msgid "Yellow"
msgstr "Gelb"

#~ msgctxt "Font size name"
#~ msgid "Small"
#~ msgstr "Klein"

Output PO (as you can see the extra Copyright comment and the unused translation were both stripped):

msgid ""
msgstr ""
"Project-Id-Version: Test Theme 1.0.0\n"
[...]

#: theme.json
msgctxt "Color name"
msgid "Yellow"
msgstr "Gelb"
@swissspidy
Copy link
Member

Thanks for sharing this suggestion 👍

I'm not sure if the gettext library we use supports that, but at first glance it looks like it at least does extract # and #~ comments:

https://github.com/php-gettext/Gettext/blob/3e7460f8d9c90174824e3f39240bd578bb3d376a/src/Extractors/Po.php#L47-L59

Then the question is whether these can be kept during the update/merge.

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

No branches or pull requests

2 participants