Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
I want to translate texts in SureCart form block with Advanced Translation Editor.
Solution:
Using the custom XML configuration code below:

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="surecart/donation" translate="1">
      <xpath>//sc-donation-choices/@label</xpath>
      <xpath>//sc-choice</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/column" translate="1">
      <xpath>//sc-customer-name/@label</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/totals" translate="1">
      <xpath>//sc-order-summary/@closed-text</xpath>
      <xpath>//sc-order-summary/@open-text</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/payment" translate="1">
      <xpath>//sc-payment/@secure-notice</xpath>
      <xpath>//sc-payment/@label</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/subtotal" translate="1">
      <xpath>//sc-line-item-total/*</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/total" translate="1">
      <xpath>//sc-line-item-total/*</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/submit" translate="1">
       <xpath>//sc-order-submit</xpath>
      <xpath>//sc-order-submit/@secure-notice-text</xpath>
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

Relevant Documentation:
https://wpml.org/documentation/support/language-configuration-files/#gutenberg-blocks

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 17 replies, has 2 voices.

Last updated by Long Nguyen 1 year, 9 months ago.

Assisted by: Long Nguyen.

Author Posts
October 19, 2023 at 11:00 pm #14619569

ljubomirM

Tell us what you are trying to do?

SureCart form is in order in originak English version. However, in Spanish version, all the time break form blocks. See link of the screencast.

Is there any documentation that you are following?

No.

Is there a similar example that we can see?

hidden link

What is the link to your site?

hidden link

You can use credentials from previous ticket.

October 23, 2023 at 4:35 am #14632931

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

It looks like the compatibility issue in this ticket https://wpml.org/forums/topic/theme-and-plugin-translation-is-not-displayed-in-front/

I will close this one and please focus on the ticket above. Thanks.

October 23, 2023 at 4:48 am #14632935

ljubomirM

Hello,

I think that you:

1) Didn't understand tickets.
2) Mixed tickets.

RESUME (for ticket)

Your reply from the other ticket belongs to this ticket. For other, please see my reply in the additional ticket.

October 24, 2023 at 2:56 am #14641887

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

As I mentioned in another ticket https://wpml.org/forums/topic/theme-and-plugin-translation-is-not-displayed-in-front/
please try to replicate the issue on the sandbox site then I will help you to check this.

Thanks.

October 24, 2023 at 4:25 am #14642001

ljubomirM

Hello,

It's done and it seems to be an incompatibility as there are still THREE PROBLEMS:

1) Although the plugin string itself is translated (WPML confirms because everything is green), let's say the word "Your cart is empty." still remains in England.

2) Although the form is translated (WPML confirms because everything is green), the word "Other" still remains in English.

3) The Spanish version of the form still has the "broken blocks" problem.

What next?

Edit-Checkout-Form-“Donación”-‹-Sandbox-—-WordPress.png
October 24, 2023 at 7:18 am #14642793

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I can replicate the issue on the sandbox site and see this. I'm asking our 2nd tier support about this issue and update you here when I have something to share.

Because this plugin is not available in our list of compatible plugins (https://wpml.org/plugin/), I also suggest you contact the plugin author and ask them to join our Go Global program where our Compatibility developers will help them to make their product compatible with WPML.
https://wpml.org/documentation/support/go-global-program/

Regarding the third issue, we are using WPML translation editor to translate the form so I think it isn't necessary to edit the form in a second language manually.

Thanks.

October 24, 2023 at 10:57 am #14646545

ljubomirM

Hello,

Unfortunately, you are wrong about the conclusion for "manually editing the form", because there is a serious problem there.

In short, the WPML translation editor is not able to "pick up" all the content of the form, due to "broken blocks", and you can easily determine this by following the steps:

1) Edit the form with the WPML translation editor, and perform the translation.

2) You edit the form manually, and perform the recovery of each "broken block". A "hidden text content" (in English) will appear on the form itself and in the right admin menu of the form. That content does not appear in the plugin strings, nor in the WPML translation editor strings. Translate it manually, and you will see that the translated content will be "lost" again (because the blocks are "broken" again).

3) The "third" hidden content of the form (details about the debit card) is additionally "interesting" here because it cannot be edited in any way in order to be translated.

October 25, 2023 at 2:32 am #14651849

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Thanks for your details. As I mentioned earlier, this plugin is not compatible with WPML so there are many issues there. I'm discussing this with our Compatibility team and I will update you here once I have any information.

Meanwhile, you can also contact SureCart support if they are aware of this issue.

Thanks.

October 26, 2023 at 1:52 am #14665755

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I got a workaround from our Compatibility team, please check this below:

Most of strings (not all) are stored as Gutenberg blocks in the post. This is the structure of the Donation form:

<!-- wp:surecart/form {"mode":"test","success_url":"","prices":[]} -->
<!-- wp:surecart/donation {"price_id":"2f84280d-c930-47b5-9057-f45b9248c78a"} -->
<sc-donation-choices price-id="2f84280d-c930-47b5-9057-f45b9248c78a" label="Donation Amount" currency="USD"><!-- wp:surecart/donation-amount {"amount":100,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="100"><sc-format-number type="currency" currency="usd" value="100" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount -->

<!-- wp:surecart/donation-amount {"amount":200,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="200"><sc-format-number type="currency" currency="usd" value="200" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount -->

<!-- wp:surecart/donation-amount {"amount":500,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="500"><sc-format-number type="currency" currency="usd" value="500" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount -->

<!-- wp:surecart/donation-amount {"amount":1000,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="1000"><sc-format-number type="currency" currency="usd" value="1000" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount -->

<!-- wp:surecart/donation-amount {"amount":2000,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="2000"><sc-format-number type="currency" currency="usd" value="2000" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount -->

<!-- wp:surecart/donation-amount {"amount":5000,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="5000"><sc-format-number type="currency" currency="usd" value="5000" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount -->

<!-- wp:surecart/donation-amount {"amount":10000,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="10000"><sc-format-number type="currency" currency="usd" value="10000" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount -->

<!-- wp:surecart/donation-amount {"amount":20000,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="20000"><sc-format-number type="currency" currency="usd" value="20000" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount -->

<!-- wp:surecart/donation-amount {"amount":50000,"currency":"usd"} -->
<sc-choice show-control="false" size="small" value="50000"><sc-format-number type="currency" currency="usd" value="50000" minimum-fraction-digits="0"></sc-format-number></sc-choice>
<!-- /wp:surecart/donation-amount --><sc-choice show-control="false" size="small" value="ad_hoc">Other</sc-choice></sc-donation-choices>
<!-- /wp:surecart/donation -->

<!-- wp:surecart/express-payment -->
<sc-express-payment divider-text="or" class="wp-block-surecart-express-payment"></sc-express-payment>
<!-- /wp:surecart/express-payment -->

<!-- wp:surecart/columns -->
<div class="wp-block-surecart-columns"><!-- wp:surecart/column -->
<div class="wp-block-surecart-column"><!-- wp:surecart/email /--></div>
<!-- /wp:surecart/column -->

<!-- wp:surecart/column -->
<div class="wp-block-surecart-column"><!-- wp:surecart/name -->
<sc-customer-name label="Name" class="wp-block-surecart-name"></sc-customer-name>
<!-- /wp:surecart/name --></div>
<!-- /wp:surecart/column --></div>
<!-- /wp:surecart/columns -->

<!-- wp:surecart/payment {"secure_notice":"This is a secure, encrypted payment"} -->
<sc-payment label="Payment" default-processor="stripe" secure-notice="This is a secure, encrypted payment" class="wp-block-surecart-payment"></sc-payment>
<!-- /wp:surecart/payment -->

<!-- wp:surecart/totals {"collapsible":true} -->
<sc-order-summary collapsible="1" closed-text="Show Summary" open-text="Summary" class="wp-block-surecart-totals"><!-- wp:surecart/divider -->
<sc-divider></sc-divider>
<!-- /wp:surecart/divider -->

<!-- wp:surecart/line-items -->
<sc-line-items removable="1" editable="1" class="wp-block-surecart-line-items"></sc-line-items>
<!-- /wp:surecart/line-items -->

<!-- wp:surecart/divider -->
<sc-divider></sc-divider>
<!-- /wp:surecart/divider -->

<!-- wp:surecart/subtotal -->
<sc-line-item-total total="subtotal" class="wp-block-surecart-subtotal"><span slot="description">Subtotal</span></sc-line-item-total>
<!-- /wp:surecart/subtotal -->

<!-- wp:surecart/coupon {"button_text":"Apply Coupon"} /-->

<!-- wp:surecart/tax-line-item -->
<sc-line-item-tax class="wp-block-surecart-tax-line-item"></sc-line-item-tax>
<!-- /wp:surecart/tax-line-item -->

<!-- wp:surecart/divider -->
<sc-divider></sc-divider>
<!-- /wp:surecart/divider -->

<!-- wp:surecart/total -->
<sc-line-item-total total="total" size="large" show-currency="1" class="wp-block-surecart-total"><span slot="title">Total</span><span slot="subscription-title">Total Due Today</span></sc-line-item-total>
<!-- /wp:surecart/total --></sc-order-summary>
<!-- /wp:surecart/totals -->

<!-- wp:surecart/submit {"text":"Donate","show_total":true,"full":true} -->
<sc-order-submit type="primary" full="true" size="large" icon="lock" show-total="true" secure-notice="true" secure-notice-text="This is a secure, encrypted payment." class="wp-block-surecart-submit">Donate</sc-order-submit>
<!-- /wp:surecart/submit -->
<!-- /wp:surecart/form -->

We can translate the strings from these blocks with the following XML snippet, which is added to WPML > Settings > Custom XML Configuration:

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="surecart/donation" translate="1">
      <xpath>//sc-donation-choices/@label</xpath>
      <xpath>//sc-choice</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/column" translate="1">
      <xpath>//sc-customer-name/@label</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/totals" translate="1">
      <xpath>//sc-order-summary/@closed-text</xpath>
      <xpath>//sc-order-summary/@open-text</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/payment" translate="1">
      <xpath>//sc-payment/@secure-notice</xpath>
      <xpath>//sc-payment/@label</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/subtotal" translate="1">
      <xpath>//sc-line-item-total/*</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/total" translate="1">
      <xpath>//sc-line-item-total/*</xpath>
    </gutenberg-block>
    <gutenberg-block type="surecart/submit" translate="1">
       <xpath>//sc-order-submit</xpath>
      <xpath>//sc-order-submit/@secure-notice-text</xpath>
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

But there are many forms that can have different structures. So it is important that the plugin author should create a file wpml-config.xml and add it to the plugin folder to translate all blocks of the plugin.
Also, they will need a custom implementation for strings that are not stored in blocks (or regular content).
Refer documentation https://wpml.org/documentation/support/language-configuration-files/#gutenberg-blocks

I recommend contacting the plugin author, reporting this issue and asking them to join our Go Global program where our Compatibility developers will help them to make their product compatible with WPML.
https://wpml.org/documentation/support/go-global-program/

Look forward to your reply.
Thanks

October 26, 2023 at 2:00 am #14665757

ljubomirM

Hello,

Just one question.

The same snippet will work for both forms (one-time donation and recurring donation)?

October 26, 2023 at 3:35 am #14665795

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Yes, I see the XML code works with both One-Time and Recurring donation forms. You can test this on the sandbox site hidden link

And view the block structure by switching to the Code editor, see the screenshot attached.

I hope I was helpful. Don't hesitate to ask if you find any problem along the way, I'll gladly help you.

Edit Checkout Form “Recurring Donation.” ‹ Sandbox — WordPress 2023-10-26 10-32-56.png
October 26, 2023 at 4:35 am #14665957

ljubomirM

Hello,

I would say that there are still problems there. Namely:

1) The Spanish version of the form in "manual edit mode" still shows "broken blocks".
2) Your custom XML has "picked up" some strings, but not all strings.

-> For example, "Your cart is empty.", "Email".
-> However, there is still a whole series of "hidden" strings. Let's say when one of the options is clicked (eg, it is like $50), new fields are "revealed" (displayed), which are still in English. For example, "Add Coupon Code", and "Recurring Donation". Untranslated English strings for the card (when the processor is connected) would definitely appear here as well.

QUESTIONS

1) Do Broken blocks affect the functionality of the Spanish version of the form or not?

2) Where are the above examples of untranslated strings (because they are not in the XML file)?

October 26, 2023 at 4:45 am #14665963

ljubomirM

If you observe image -03 you will see that the string "Enter an amount" is translated, but still, appears in English.

Screenshot 2023-10-25 at 23-43-45 String Translation ‹ Sandbox — WordPress.png
Donación-recurrente-–-Sandbox-03.png
Donación-recurrente-–-Sandbox-02.png
Donación-recurrente-–-Sandbox-01.png
October 26, 2023 at 7:36 am #14666965

Long Nguyen
WPML Supporter since 02/2022

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

1. I do not have SureCart account and Payment Processor as the form required to make a test donation. Can you please help me to set it up and test it on the sandbox site? As I can see the translation strings in Advanced Translation Editor are displayed in Spanish as well.

2. As I mentioned above, those strings are not included in the form setup (Gutenberg block) SureCart > Forms > Donation. They are stored in the plugin files and even translated in String Translation, they are not displayed in the frontend.
For those strings, please contact the plugin author, report this issue and ask them for a custom implementation for strings that are scanned and translated with the gettext function __().

Look forward to your reply.
Thanks

October 26, 2023 at 9:27 am #14668603

ljubomirM

Hello,

1) I reset all previous settings and reconnected to my new SureCart and Stripe accounts. For that reason, I deleted all other forms except the newly created two forms (one-time and recurring).

2) I translated all strings of the plugin and that's why I attached in previous reply image with the plugin string "Enter An Amount" as that string belongs to the plugin and not to forms. However, it is not successfully displayed on the Spanish page.

NOTE

In the previous reply, I attached other screenshots to display strings from the form that are not translated and displayed.