Sysmagine / SemanticDiff

Community support for SemanticDiff, the programming language aware diff for Visual Studio Code and GitHub.
https://semanticdiff.com
40 stars 0 forks source link

Support for PO (gettext) files #17

Closed abePdIta closed 1 year ago

abePdIta commented 1 year ago

Support for PO translation files will be a game changer. Diffs are often 99% comments changes, as they usually contain file/line references of where the translation is used. Also, PO support may not be so difficult to implement, IMHO.

Thanks in advance!

mmueller2012 commented 1 year ago

Thanks for the great idea.

Would you like SemanticDiff to hide all changes in directives starting with # or just in code references? Here is a list of all directives starting with # from https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html:

#  translator-comments
#. extracted-comments
#: reference…
#, flag…
#| msgctxt previous-context
#| msgid previous-untranslated-string
#| msgid_plural previous-untranslated-string-plural

I guess it would make sense to hide all of them since they are mostly used for informational purposes, but wanted to make sure this would fit your use case.

mmueller2012 commented 1 year ago

We went ahead and added support for PO files, including the option to ignore changes inside of comments. SemanticDiff also ignores when the order of messages gets swapped.

You can try it out now with our pull request viewer:

To toggle between both modes you have to click on this newly added button:

image

We will be releasing a new version of our Visual Studio Code extension soon so that you can also get support for diffing PO files in VS Code. If you have any feedback, it would be a good time to make some adjustments before the release.

abePdIta commented 1 year ago

These are awesome news! Thank you for your really quick reaction! I agree with you: lines starting with # are not meaningful from a translation point of view, but I really appreciate the option.

Thanks again!

abePdIta commented 1 year ago

I was able to test SemanticDiff in a real case: a commit of a PO file with 139 additions and 126 suppressions. SemanticDiff did an excellent job: the real changes were detected correctly and everything else hidden by the convenient filter! Great job, thank you very much!