Comments (7)
The addtextdomain
tool isn't very sophisticated, so it does have some limitations. As far as I'm aware, it will actually append the text domain if there's already an existing, different text domain, so it may not even work as well as a search/replace in this scenario.
The best bet may be to allow one or more old text domains to be specified as an option that should be updated. Something like:
addtextdomain: {
options: {
textdomain: 'newdomain',
updateDomains: [ 'olddomain1', 'olddomain2' ]
}
}
from grunt-wp-i18n.
As far as I'm aware, it will actually append the text domain if there's already an existing, different text domain
That's what it does, yes.
from grunt-wp-i18n.
Looks like https://github.com/stephenharris/grunt-checktextdomain has a feature than can correct (not just append) text domains.
from grunt-wp-i18n.
Aside from the stuff necessary for passing the parameters from Grunt to PHP, this is really all that was needed to get this working.
Anyone up for testing it out or have any feedback on its usefulness?
from grunt-wp-i18n.
"grunt-wp-i18n": "git://github.com/blazersix/grunt-wp-i18n.git#develop",
^^^ in the package.json
, and then cd
into the project directory and run npm install
will pull down the develop branch for testing.
Replace with:
"grunt-wp-i18n": "^0.4.6",
when finished.
I think the most obvious usefulness is when creating a new theme out of a starter theme.
The current updating works well. Updating textdomain 'foo' with textdomain 'foo' didn't cause any problems.
Developing it further I'd like to see:
updateDomains: ['foo', 'bar']
only replaces domains in the whitelist (this is what develop branch does now).updateDomains: true
would replace ALL domains with the right textdomain. This helps when you don't know what all the existing domains are (perhaps PHP functions copied and pasted from multiple sources), but you know they should all be a single one for the project.- More feedback given (e.g.
grunt.log.writeln
) about what which domains were replaced, which were added, and in which files / lines (maybe only with `--verbose). I'll open a new Issue for this.
from grunt-wp-i18n.
Thanks for the feedback, Gary, as well as the detailed instructions for testing. I should really get that incorporated in some documentation somewhere.
The updateDomains: true
option sounds worthwhile, but also sounds like a decent amount of work. I'll open a separate issue for that.
from grunt-wp-i18n.
These changes were released in v0.4.7
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.