Comments (23)
Updating headers should be possible, but I'll have to find some time to add options to define those.
from grunt-wp-i18n.
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.
would this also work for adding header items that the i18n tools library donβt add themselves?
from grunt-wp-i18n.
@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.
Cool! Will check it out.
from grunt-wp-i18n.
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.
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.
Hmm, couldn't make that work either. It's not actually updating to the develop branch when I put this in my package.json
and run npm install
:
"devDependencies": {
"grunt": "~0.4.1",
"grunt-wp-i18n": "git://github.com/blazersix/grunt-wp-i18n.git#develop"
},
from grunt-wp-i18n.
It might be the cache. Try running npm cache clean
before doing npm install
.
from grunt-wp-i18n.
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.
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.
Yeah, I'm checking the package inside the node_modules
and it's not updating.
from grunt-wp-i18n.
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.
I keep getting this error: Fatal error: Cannot set property 'language-team' of undefined
from grunt-wp-i18n.
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.
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.
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.
Just published this change in 0.4.2
from grunt-wp-i18n.
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.
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.
Thanks π
from grunt-wp-i18n.
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.
Perfect, working as expected now thank you π
from grunt-wp-i18n.
Related Issues (20)
- Ignore certain domain (e.g. via an options.dontUpdateDomains) HOT 12
- Warning: Cannot read property 'split' of undefined HOT 6
- Exclude page templates HOT 3
- "updateTimestamp: false" is not working properly HOT 3
- Exclude doesn't included in .pot file HOT 2
- Send modified files to build path only HOT 2
- Not Working on Windows ver > 8
- Good way to eliminate duplicates in pot file HOT 8
- Running "makepot" task keeps running forever HOT 4
- update node-wp-i18n to v1.0.5 HOT 1
- updateTimestamp: false not working HOT 8
- Detecting msgid stored in variable HOT 1
- Warning: Cannot read property 'pot-creation-date' of undefined Use --force to continue. HOT 1
- POT File by text domain HOT 2
- Switch to using `wp i18n make-pot` HOT 6
- Makepot supports for monorepo plugins HOT 1
- Addtextdomain throws error HOT 1
- Better output when makepot fails due to missing PHP cli
- Warnings when running on PHP 8 HOT 2
- Duplicate text domains added where text domain already exists HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-wp-i18n.