Skip to content

How to add translation to payment methods in checkout?

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?