202-ecommerce / stripe_official

After years of hard work with Stripe connector for PrestaShop, 202 ecommerce stop the development of Stripe module on January 9th 2023. Thanks for all contributors that help us!
20 stars 20 forks source link

How to translate string 'Card via Stripe' #138

Closed pschiffe closed 2 years ago

pschiffe commented 2 years ago

Hello,

I'm not able to translate the payment name, used in history of orders, or in confirmation emails, which reads 'Card via Stripe'. I found the line in source code here: https://github.com/202-ecommerce/stripe_official/blob/master/classes/actions/ValidationOrderActions.php#L349 But I'm not able to find the string in module translations in PrestaShop backoffice.

Can you help?

Thank you,

peter

clotairer commented 2 years ago

Hi @pschiffe

You're right, the syntaxt looks incorrect. I create for you a PR #139 Could you please tell me if it fix your issue ?

pschiffe commented 2 years ago

I can now translate string %s via Stripe, but not Card. So it's like Card translated. There is only Cards string in the module translations.

clotairer commented 2 years ago

For now it come from a variable returned by Stripe according to the payment method. So, I don't find a generic way to let you translate this. What's your exact need ?

pschiffe commented 2 years ago

Our eshop is not in english language, word Card doesn't exist.

I don't really know how the translations works, but wouldn't this work?

                sprintf(
                    $this->module->l('%s via Stripe', 'ValidationOrderActions'),
                    $this->module->l(Tools::ucfirst(Stripe_official::$paymentMethods[$this->conveyor['datas']['type']]['name']))
                ),
pschiffe commented 2 years ago

Hm, I probably should be able to workaround this by leaving %s out of the translated string. We are using only Card payment, so it's good enough for us.

clotairer commented 2 years ago

We could add an list of translation like here for pay button:

https://github.com/202-ecommerce/stripe_official/blob/3568089bac2bba14e54bc44ea3babcf77a80f7e5/stripe_official.php#L422-L427

pschiffe commented 2 years ago

Yep, I think that would be ideal. I'm using translation of Pay by card from there as the name of the payment on the checkout page.

clotairer commented 2 years ago

I note that. Keep in touch.

clotairer commented 2 years ago

Hi,

We just publish as pre-release 2.4.4 that add a partial fix that let you translate "Card by Stripe". Unfortunatly, merchant that have synchronization with an ERP, are not happy that we change the label (even if it's just a translation) because it can break there feeds. For now, We decided to let translate the string but not the method of payment (SoFort, iDeal, Card, ...).

Thank you.

pschiffe commented 2 years ago

OK, thank you. I can workaround it by custom translation without %s, since I'm using only one method.