Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Translation of "Proceed to Checkout" button isn't working #5452

Closed
nielslange opened this issue Dec 24, 2021 · 0 comments · Fixed by #5453
Closed

Translation of "Proceed to Checkout" button isn't working #5452

nielslange opened this issue Dec 24, 2021 · 0 comments · Fixed by #5453
Labels
block: cart Issues related to the cart block. focus: i18n The issue/PR is related to internationalization. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue/PR concerns a confirmed bug.

Comments

@nielslange
Copy link
Member

Describe the bug

In #5112, we added missing lazy loaded translations files. In 4629379-zd-woothemes, a customer reported that the Norwegian translation of the "Proceed to Checkout" button isn't working.

I looked up this problem and found out that it’s caused by the following section:

https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/b56790a52c41730de4fba25bb1640b6a0d7c46c0/src/BlockTypes/Cart.php#L205-L218

Instead of cart-blocks/checkout-button, we’re currently referring to cart-blocks/checkout-button-frontend.js. This leads to the fact that the translation of the "Proceed to Checkout" button does not get loaded.

To reproduce

  1. Create a test page and add the cart block.
  2. Go to /wp-admin/options-general.php and change the site language to Norsk bokmål.
  3. Go to /wp-admin/update-core.php and update the translations.
  4. Go to the frontend, add a product and look up the test page with the cart block.
  5. See that the "Proceed to Checkout" button is not translated, even though a Norwegian translation exists.

Expected behavior

The translation of the "Proceed to Checkout" button should be visible.

Screenshots

store local_cart_(iPad Pro)

Temporary fix

The following code snippet allows to temporarily fix this problem:

// Define our filter callback.
function myPluginGettextFilter( translation, text, domain ) {
	if ( text === 'Proceed to Checkout' ) {
		return 'Fortsett til kassen';
	}
	return translation;
}

// Adding the filter
wp.hooks.addFilter(
	'i18n.gettext',
	'my-plugin/override-fulfilled-all-orders-text',
	myPluginGettextFilter
);

This code snippet can be added to a WordPress site using the Simple Custom CSS and JS plugin:

store local_wp-admin_post php_post=1049 action=edit(iPad Pro)

@nielslange nielslange added type: bug The issue/PR concerns a confirmed bug. focus: i18n The issue/PR is related to internationalization. block: cart Issues related to the cart block. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. labels Dec 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: cart Issues related to the cart block. focus: i18n The issue/PR is related to internationalization. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
1 participant