Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin's meta data #37

Open
marcochiesi opened this issue Oct 5, 2014 · 9 comments
Open

Plugin's meta data #37

marcochiesi opened this issue Oct 5, 2014 · 9 comments

Comments

@marcochiesi
Copy link
Contributor

Is there a way to control which plugin meta data are included in the .pot file?
In example I would like only plugin's description (and maybe name) to be translatable, while plugin's author and URI's not.

@GaryJones
Copy link
Contributor

This looks to be down to makepot.php, not something specific in grunt-wp-i18n. I personally don't think this option should be something that is added here, but @bradyvercher may disagree.

My suggestion would to add a grunt-contrib-replace task that can find and remove bits from the .pot file after it has been generated.

@marcochiesi
Copy link
Contributor Author

I went for an alternate solution, using the processPot callback:

        processPot: function( pot ) {
            var translation, excluded_meta = [ 'Plugin Name of the plugin/theme', 'Plugin URI of the plugin/theme', 'Author of the plugin/theme', 'Author URI of the plugin/theme' ];
            for ( translation in pot.translations[''] ) {
                if ( typeof pot.translations[''][translation].comments.extracted != 'undefined' ) {
                    if ( excluded_meta.indexOf( pot.translations[''][translation].comments.extracted ) >= 0 ) {
                        delete pot.translations[''][translation];
                        console.log( 'Excluded meta: ' + pot.translations[''][translation].comments.extracted );
                    }
                }
            }
            return pot;
        },

Perhaps it could be added to the documentation as example.

@GaryJones
Copy link
Contributor

Adding it as a Wiki page would be a good start, then do a PR with for the README with this as an advanced example.

@marcochiesi
Copy link
Contributor Author

I see that currently there are no wiki pages for this project and the docs are in separate files linked from the README. Should I add this at the end of makepot.md?

@GaryJones
Copy link
Contributor

Yes, that seems like the best place :-)

@bradyvercher
Copy link
Member

I agree with Gary that an option isn't needed for this, but that's exactly what the processPot callback is for, so I'm glad you found that useful!

Adding an advanced usage section at the bottom of makepot.md should be fine for now, but I'd be all for starting up the wiki with usage examples if someone wanted to take that on.

marcochiesi added a commit to marcochiesi/grunt-wp-i18n that referenced this issue Oct 8, 2014
@bradyvercher
Copy link
Member

Thanks for the PR, @marcochiesi!

@shivapoudel
Copy link
Contributor


Hey @marcochiesi great work

@bradyvercher
Copy link
Member

This seems to be a pretty popular option, so I'm reopening for discussion on ways to make it easier to implement.

@bradyvercher bradyvercher reopened this Oct 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants