cedaro / grunt-wp-i18n

Internationalize WordPress themes and plugins with Grunt.
MIT License
160 stars 25 forks source link

updateTimestamp: false not working #76

Closed themenow closed 5 years ago

themenow commented 6 years ago

Still the date is updated without other changes, I'm using the latest version 1.0.2

makepot: {
    theme: {
        options: {
            cwd: '',
            mainFile: 'style.css',
            domainPath: 'languages/',
            exclude: ['node_modules/.*'],
            potFilename: '<%= x %>.pot',
            potHeaders: { 'report-msgid-bugs-to': 'http://theme-homepage' },
            type: 'wp-theme',
            updateTimestamp: false,
        }
    }
};

By the way, do I need to add also '.svn' to exclude ?

bradyvercher commented 6 years ago

I haven't had time to look into this, but there is a passing test for this . If anyone can demonstrate this behavior with a failing test, that would be helpful.

av3nger commented 5 years ago

updateTimestamp: false regenerates the .pot file for me as well with only the changed timestamp

diff --git a/languages/default.pot b/languages/default.pot
index ea5f43f1..7e9ad854 100644
--- a/languages/default.pot
+++ b/languages/default.pot
@@ -4,7 +4,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: Project Name\n"
-"POT-Creation-Date: 2018-12-19 10:38:42+00:00\n"
+"POT-Creation-Date: 2018-12-19 10:39:15+00:00\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
bradyvercher commented 5 years ago

@av3nger I haven't been able to replicate this. If you could submit a failing test or step through the code to determine where the issue is, that would be helpful.

av3nger commented 5 years ago

@bradyvercher , I don't know if this helps, but it's failing at Pot.prototype.sameAs() the pot.content contains X-Generator: grunt-wp-i18n1.0.2 which this.contents does not contain. thus the hashes for the files do not match

bradyvercher commented 5 years ago

Thanks, but that doesn't really give me any ideas. Is there a reason you know of that would cause the generated POT to be missing the X-Generator header?

The Grunt tasks adds that header to the options, then sends those along to the node package. The node package reads the existing POT file, generates a new one, then compares the original with the generated version to see if there have been any changes. The X-Generator header should be in both versions.

av3nger commented 5 years ago

@bradyvercher, you can configure a separate test task, run it with grunt and compare pot.content and this.contents - they do not match. X-Generator is present in the headers of both outputs, but it's not there in msgstr section in one of the files

bradyvercher commented 5 years ago

@av3nger Ah, thanks for sticking with me on that. I think I figured out what was going on and hopefully this commit should take care of it.

bradyvercher commented 5 years ago

I believe this should be good to go in 1.0.3. Feel free to reopen with more details if it still doesn't work.