2

I would like to display translated offline-payment method titles in my onestep checkout page. The translations are already added to the translations.csv file.

The problem is - the method at <span data-bind="text: getTitle()"></span> in html template returns the original payment method title, not translated. Using $t() or i18n directives does not translate it either.

If however, I add hardcoded payment method name in translate function $t() somewhere in the template, it returns translated version of the string. And then also $t(getTitle()) method returns translated version.

I found this at magento devdocs https://developer.adobe.com/commerce/frontend-core/guide/translations/theory/#strings-added-in-ui-components-configuration-files but am not sure if this is related to or not to my issue.

Maybe someone can explain how this task could be done properly?

1 Answer 1

1

Translation for <span data-bind="text: getTitle()"></span> this will not work from here.

You are getting the name of Payment method on checkout page.

So to translate this span tag you have to change it from Admin Panel

Stores > Configurations > Sales > Payment Methods

Now choose your payment method and Select the Scope for which you want to change the translation enter image description here

Just update the Title with your translation text and check on the checkout page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.