It looks like gulp-wp-pot
is not picking up translations inside (some?) filters or functions.
I have two local sites. Site 1 is running gulp-wp-pot
2.3.6 and site 2 is 2.4.0. They're using the exact same gulp file, packages, theme and structure except all packages are up to date on site 2.
Site 1, running gulp-wp-pot
2.3.6 , is correctly picking up translations inside this function from mytheme/woocommerce/checkout/form-coupon.php:
<?php wc_print_notice( apply_filters( 'woocommerce_checkout_coupon_message', esc_html__( 'Have a gift card?', 'sg-one' ) . ' <a href="#" class="showcoupon">' . esc_html__( 'Click here to use your gift card', 'sg-one' ) . '</a>' ), 'notice' ); ?>
This function is the same as the WooCommerce core function - i just replaced the translatable strings and translation domain.
The exact same translations are however not generated for site 2, running gulp-wp-pot
2.4.0.
This simple string is also in the same template file:
<p><?php esc_html_e( 'If you have a gift card code, please apply it below.', 'sg-one' ); ?></p>.
Both versions generate this string just fine. That's why I suspect that there is some bug with functions/filters.
These are my dev dependencies:
"devDependencies": {
"browser-sync": "^2.26.7",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-concat": "^2.6.1",
"gulp-ext-replace": "^0.3.0",
"gulp-imagemin": "^7.1.0",
"gulp-sass": "^4.0.2",
"gulp-sort": "^2.0.0",
"gulp-sourcemaps": "^2.6.5",
"gulp-uglify": "^3.0.2",
"gulp-wp-pot": "^2.4.0",
"gulp-zip": "^5.0.1",
"imagemin-mozjpeg": "^8.0.0",
"imagemin-webp": "^5.1.0",
"merge-stream": "^2.0.0",
"pump": "^3.0.0"
}
This is my gulp task:
gulp.task('translate', function() {
return gulp.src(themeDir + '**/*.php')
.pipe(sort())
.pipe(wpPot({
domain : 'sg-one',
package : 'SG One'
}))
.pipe(gulp.dest(themeDir + 'languages/en_GB.pot'))
});
I'm still having the issue without .pipe(sort())
.