GithubHelp home page GithubHelp logo

Comments (10)

swissspidy avatar swissspidy commented on June 3, 2024

This would mean we need to work with the AST of PHP / JavaScript file.

#26 already uses a JS AST parser.

https://github.com/nikic/PHP-Parser is a popular one for PHP. It would make sense to use that for the make-pot task as well, however it requires PHP 7.

from i18n-command.

swissspidy avatar swissspidy commented on June 3, 2024

After looking at #28 I think this command would need:

  1. An --only-missing option to only add the domain where it's missing
  2. A way to only replace a specific domain with a new one, in case the source folder contains strings with multiple text domains.

from i18n-command.

varunsridharan avatar varunsridharan commented on June 3, 2024

@swissspidy is there any update on this ?

from i18n-command.

varunsridharan avatar varunsridharan commented on June 3, 2024

@swissspidy how can i use add-text-domain cmd in cli to append text domains to wp functions inside my plugin / theme ( __() )

from i18n-command.

swissspidy avatar swissspidy commented on June 3, 2024

@varunsridharan No update I am afraid. add-text-domain does currently not exist.

However, you can achieve this using the WordPress-Coding-Standards PHPCS configuration as long as you set your text domain accordingly.

I think that is probably the best solution for this specific task.

Once you've configured PHPCS with the WordPress coding standards, you can use phpcbf to automatically fix any i18n functions that don't use your required text domain.

from i18n-command.

varunsridharan avatar varunsridharan commented on June 3, 2024

@swissspidy thanks for your faster reply. well i work on quite a lot of projects and i use common rules-set.xl in phpstorm and i dont think that will work for me :-(

from i18n-command.

swissspidy avatar swissspidy commented on June 3, 2024

I think that should still work. You don't have to include all of WPCS in your ruleset, just the text domain sniff is enough. Then, you can even auto-fix things directly in PHPStorm.

from i18n-command.

varunsridharan avatar varunsridharan commented on June 3, 2024

Based on my testing i can say that PHPStorm dose not support multiple ruleset in a single project.

from i18n-command.

varunsridharan avatar varunsridharan commented on June 3, 2024

@swissspidy thanks for your time. i was not able to get this done using PHPStrom / Rule set not sure why may be i was doing something wrong.

and i created a simple composer package which dose this job
Old Link : https://github.com/varunsridharan/wp-cli
New Link : https://github.com/varunsridharan/wp-cli-textdomain

from i18n-command.

swissspidy avatar swissspidy commented on June 3, 2024

Closing for now as this seems better suited for a tool like PHPCS, as mentioned in the discussion above. https://github.com/varunsridharan/wp-cli-textdomain exists for people who want a dedicated command/script.

from i18n-command.

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.