cedaro / grunt-wp-i18n

Internationalize WordPress themes and plugins with Grunt.
MIT License
160 stars 25 forks source link

Duplicate text domains added where text domain already exists #86

Closed helgatheviking closed 2 years ago

helgatheviking commented 2 years ago

My grunt task looks like:

addtextdomain: {
            options: {
                textdomain: '<%= pkg.name %>'    // Project text domain.
            },
            target: {
                files: {
                    src: ['*.php', '**/*.php', '**/**/*.php', '!node_modules/**', '!deploy/**']
                }
            }
        },

where the package.json name is

"name": "wc-mnm-grouped",
 <?php esc_html_e( 'No related Mix and Match products', 'wc-grouped-mnm' ); ?>

gets turned into

 <?php esc_html_e( 'No related Mix and Match products', 'wc-grouped-mnm', 'wc-mnm-grouped' ); ?>

I can't quite tell if this is a bug or a human error on my part, but how can I stop getting the 2nd text domain from being added where it already exists?

bradyvercher commented 2 years ago

Hi @helgatheviking, it's been awhile, so I'd have to dig in to see why a second text domain would be added when one already exists, but it looks like the two don't quite match (wc-grouped-mnm vs wc-mnm-grouped). Could that be the root of the issue? If so, you might look into the updateDomains option.

helgatheviking commented 2 years ago

Well I feel silly. But you look at something long enough and it all starts to look the same. Thanks so much for catching that! that was indeed the source of the problem.

bradyvercher commented 2 years ago

No worries! Glad to hear that took care of it.