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

Not picking up translations used inside filters #108

Closed
Jeppeskovsgaard opened this issue Apr 3, 2020 · 1 comment
Closed

Not picking up translations used inside filters #108

Jeppeskovsgaard opened this issue Apr 3, 2020 · 1 comment

Comments

@Jeppeskovsgaard
Copy link

Jeppeskovsgaard commented Apr 3, 2020

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()).

rasmusbe added a commit that referenced this issue Apr 6, 2020
@rasmusbe
Copy link
Collaborator

rasmusbe commented Apr 6, 2020

Thanks for your report, should be fixed in 2.4.1

@rasmusbe rasmusbe closed this as completed Apr 6, 2020
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

2 participants