Giter Site home page Giter Site logo

Comments (23)

bradyvercher avatar bradyvercher commented on June 2, 2024

Updating headers should be possible, but I'll have to find some time to add options to define those.

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

I just pushed a commit that should give you complete access to the POT file after it's been generated and let you modify it any way you want using a callback. As an example for changing that header, you can add an option like this:

makepot: {
    target: {
        options: {
            processPot: function( pot, options ) {
                pot.headers['report-msgid-bugs-to'] = 'http://wordpress.org/support/plugin/flowplayer5';
                return pot;
            }
        }
    }
}

It's not totally config-based, but should give people much more control over the output. Let me know if that's helpful.

from grunt-wp-i18n.

remkus avatar remkus commented on June 2, 2024

would this also work for adding header items that the i18n tools library don’t add themselves?

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

@deFries Yep, that's the idea. Just add or overwrite keys in that headers object and they should be saved back to the POT file.

from grunt-wp-i18n.

remkus avatar remkus commented on June 2, 2024

Cool! Will check it out.

from grunt-wp-i18n.

remkus avatar remkus commented on June 2, 2024

I've tried this – by updating the grunt-wp-i18n Gruntfile.js file –, but couldn't get it to work. This is what my Gruntfile.js contains:

 // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    makepot: {
           target: {
               options: {
                   domainPath: '/languages',
                   potFilename: 'wordpress-seo.pot',
                   processPot: function( pot, options ) {
                                   pot.headers['plural-forms'] = 'nplurals=2; plural=n != 1;\n"';
                                   pot.header['language-team'] = 'Yoast Translate <[email protected]>\n';
                                   return pot;
                               },
                   type: 'wp-plugin'
               }
           }
       }
  });

None of the overrides are actually processed.

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

Sorry, I should have been more clear. That commit hasn't been released yet, so you need to specify the dev version in your package.json to test it out. Change the package version to the following URL and run npm install: git://github.com/blazersix/grunt-wp-i18n.git#develop

from grunt-wp-i18n.

remkus avatar remkus commented on June 2, 2024

Hmm, couldn't make that work either. It's not actually updating to the develop branch when I put this in my package.jsonand run npm install:

"devDependencies": {
    "grunt": "~0.4.1",
    "grunt-wp-i18n": "git://github.com/blazersix/grunt-wp-i18n.git#develop"
  },

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

It might be the cache. Try running npm cache clean before doing npm install.

from grunt-wp-i18n.

remkus avatar remkus commented on June 2, 2024

Cleared cache and although that make the npm install script do more, it still hasn't updated this project to the latest develop branch.

I get the following error message:
Fatal error: Cannot set property 'language-team' of undefined

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

Hmm, that's strange. How are you checking the package to see if it updated? The only thing that's changed since the last release is this commit, so you'd have to see if any of that exists rather than checking a version number anywhere.

If that doesn't help, I may just have to go ahead and release that change. I was hoping to have it tested a little more.

from grunt-wp-i18n.

remkus avatar remkus commented on June 2, 2024

Yeah, I'm checking the package inside the node_modules and it's not updating.

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

Ahh, gotcha. That won't change since I haven't bumped versions. You should already have the dev version, so just try running grunt makepot again and see if it updates those headers.

from grunt-wp-i18n.

remkus avatar remkus commented on June 2, 2024

I keep getting this error: Fatal error: Cannot set property 'language-team' of undefined

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

In your processPot callback, update those two header lines to this:

pot.headers['plural-forms'] = 'nplurals=2; plural=n != 1;';
pot.headers['language-team'] = 'Yoast Translate <[email protected]>';

There was a missing "s" on headers for the language team item, and I removed the newlines and an extra double quote.

from grunt-wp-i18n.

remkus avatar remkus commented on June 2, 2024

Son of a .. that was the issue. Was too to damn focused on the output that I missed the obvious mistake. Thanks Brady!

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

No problem. Glad it worked!

I'll see about getting that change released soon so you don't have to jump through hoops to use it in the future. Thanks for helping test it out!

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

Just published this change in 0.4.2

from grunt-wp-i18n.

ntwb avatar ntwb commented on June 2, 2024

Rather than opening a new ticket, I just read the above and implemented the above for bbPress πŸ‘

It works perfectly with the dev branch "grunt-wp-i18n": "git://github.com/blazersix/grunt-wp-i18n.git#develop"

I performed a npm cache clean, changed back to v0.4.2 "grunt-wp-i18n": "~0.4.2", and ran npm install

[email protected] node_modules\grunt-wp-i18n
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
β”œβ”€β”€ [email protected]
└── [email protected] ([email protected])

So it looks like grunt-wp-i18n v0.4.2 installed fine it just doesn't add the headers using v0.4.2?

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

Apparently I somehow forgot to merge the changes into the master branch before tagging and publishing. Whoops! Let me see if I can re-tag it with the changes.

from grunt-wp-i18n.

ntwb avatar ntwb commented on June 2, 2024

Thanks πŸ˜‰

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 2, 2024

I couldn't publish to npm using the same tag, so these changes are in 0.4.3 now. Give that a go and let me know if you run into any more issues.

from grunt-wp-i18n.

ntwb avatar ntwb commented on June 2, 2024

Perfect, working as expected now thank you πŸ‘

from grunt-wp-i18n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.