Code Monkey home page Code Monkey logo

Comments (7)

bradyvercher avatar bradyvercher commented on June 4, 2024

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.

remkus avatar remkus commented on June 4, 2024

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.

GaryJones avatar GaryJones commented on June 4, 2024

Looks like https://github.com/stephenharris/grunt-checktextdomain has a feature than can correct (not just append) text domains.

from grunt-wp-i18n.

bradyvercher avatar bradyvercher commented on June 4, 2024

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.

GaryJones avatar GaryJones commented on June 4, 2024

"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.

bradyvercher avatar bradyvercher commented on June 4, 2024

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.

bradyvercher avatar bradyvercher commented on June 4, 2024

These changes were released in v0.4.7

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.