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

"i18n.PostBuild.exe": don't do ".backups" and time stamps #279

Closed
artkpv opened this issue Jul 1, 2016 · 7 comments
Closed

"i18n.PostBuild.exe": don't do ".backups" and time stamps #279

artkpv opened this issue Jul 1, 2016 · 7 comments

Comments

@artkpv
Copy link

artkpv commented Jul 1, 2016

Hello,
Thanks for the great tool!

How can we stop i18n.PostBuild.exe to make the backup files and stop it to make time stamps in .po files like "POT-Creation-Date" and "PO-Revision-Date" ? This is a noise to git which handles updates and backups nicely.

@turquoiseowl
Copy link
Owner

AFAIK there aren't any switches currently to control that but please feel free to contribute that functionality. Thanks.

@jeancroy
Copy link
Contributor

jeancroy commented Jul 1, 2016

I may have an interest to fix this on our side too, I'll have one question.

The problem:
PostBuild regenerate pot & po data with a timestamp that basically is the time of the last build.
In a source control environment that timestamp conflict on each merge or almost. 👎

I can exclude /locale/.pot and /locale/.backup from source control as they are automatically generated, but would like to keep the .po as it contain human generated translation.

The curlpit:

In this method SaveTranslation
var POTDate = DateTime.Now;

So basically the metadata can never stay the same.

The patch:

I'm thinking of a flag that disable those two lines

The question

What exactly is MergeAllTranslation doing ?

In particular does it do the same as PoEdit > Catalog> UpdateFromPotFIle ?
screenshot_1

If so it'll be worth 1000x time to do it manually and don't break source control.

The long term plan

Allow generated file to be indempotent.
For example take the md5 of the pot file body (without timestamp header) and if body is the same, abort save template / mere translation.

My plan

Translation got pushed away on my current project, so I'll disable autobuild.
But if this is still a problem in about a month I'll find time to correct it cleanly.

@turquoiseowl
Copy link
Owner

A nice feature of PO GetText is that translation messages that become redundant over time are preserved in the .PO files (as unreferenced messages) in case they are ever brought back into use. The logic that does this is what the 'Merge' refers to. Here's some relevant notes from the code:

        public void MergeTranslation(IDictionary<string, TemplateItem> src, Translation dst)
        {
        // Our purpose here is to merge newly parsed message items (src) with those already stored in a translation repo (dst).
        // 1. Where an orphan msgid is found (present in the dst but not the src) we update it in the dst to remove all references.
        // 2. Where a src msgid is missing from dst, we simply ADD it to dst.
        // 3. Where a src msgid is present in dst, we update the item in the dst to match the src (references, comments, etc.).
        //

I'm not sure whether that's the same as the PO edit feature, but also can't see we can avoid the merge as part of PostBuild.

@vhatuncev
Copy link
Contributor

Any updates on this issue? Really anoyning each build to see changes in po and pot files.

@turquoiseowl
Copy link
Owner

I think this was fixed #331.

That is included in the latest pre-release nuget packages, the latest being 2.1.11-pre002.

@vhatuncev
Copy link
Contributor

Ok, thank you!

@artkpv
Copy link
Author

artkpv commented Mar 30, 2018

Fixed in #331 @turquoiseowl thanks !

@artkpv artkpv closed this as completed Mar 30, 2018
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

4 participants