Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue with some translation in payment buttons #593

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alma/lib/Helpers/PaymentOptionTemplateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public function buildTemplateVar(

if ($isDeferred) {
$templateVar['installmentText'] = sprintf(
$this->translationHelper->getTranslation('0 € today then %1$s on %2$s', 'PaymentOptionsHookController'),
$this->translationHelper->l('0 € today then %1$s on %2$s', 'PaymentOptionTemplateHelper'),
$this->priceHelper->formatPriceToCentsByCurrencyId(
$plans[0]['purchase_amount'] + $plans[0]['customer_fee']
),
Expand Down
6 changes: 3 additions & 3 deletions alma/lib/Helpers/PlanHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,18 @@ public function buildDates($plans, $locale, $feePlans, $key, $isPayNow)
$plans[$keyPlan]['human_date'] = $this->dateHelper->getDateFormat($locale, $paymentPlan['due_date']);

if (0 === $keyPlan) {
$plans[$keyPlan]['human_date'] = $this->translationHelper->getTranslation('Today', 'PaymentService');
$plans[$keyPlan]['human_date'] = $this->translationHelper->l('Today', 'PlanHelper');
continue;
}

if ($isPayNow) {
$plans[$keyPlan]['human_date'] = $this->translationHelper->getTranslation('Total', 'PaymentService');
$plans[$keyPlan]['human_date'] = $this->translationHelper->l('Total', 'PlanHelper');
continue;
}

if ($this->settingsHelper->isDeferredTriggerLimitDays($feePlans, $key)) {
$plans[$keyPlan]['human_date'] = sprintf(
$this->translationHelper->getTranslation('%s month later', 'PaymentService'),
$this->translationHelper->l('%s month later', 'PaymentService'),
$keyPlan
);

Expand Down
2 changes: 1 addition & 1 deletion alma/lib/Helpers/TranslationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct($moduleFactory)
*
* @return mixed
*/
public function getTranslation($string, $file)
public function l($string, $file)
{
return $this->module->l($string, $file);
}
Expand Down
4 changes: 2 additions & 2 deletions alma/tests/Unit/Helper/PaymentOptionTemplateHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function testBuildTemplateVarNoDeferredPlan()
$this->settingsHelperMock->shouldReceive('getModeActive')->andReturn('test');
$this->settingsHelperMock->shouldReceive('getIdMerchant')->andReturn('merchantId');
$this->configurationHelperMock->shouldReceive('isInPageEnabled')->andReturn(true);
$this->translationHelperMock->shouldReceive('getTranslation')->andReturn('My translation');
$this->translationHelperMock->shouldReceive('l')->andReturn('My translation');
$this->priceHelperMock->shouldReceive('formatPriceToCentsByCurrencyId')->andReturn('110.00');
$this->dateHelperMock->shouldReceive('getDateFormat')->andReturn('22/05/2024');

Expand Down Expand Up @@ -163,7 +163,7 @@ public function testBuildTemplateVarDeferredPlan()
$this->settingsHelperMock->shouldReceive('getModeActive')->andReturn('test');
$this->settingsHelperMock->shouldReceive('getIdMerchant')->andReturn('merchantId');
$this->configurationHelperMock->shouldReceive('isInPageEnabled')->andReturn(true);
$this->translationHelperMock->shouldReceive('getTranslation')->andReturn('My translation');
$this->translationHelperMock->shouldReceive('l')->andReturn('My translation');
$this->priceHelperMock->shouldReceive('formatPriceToCentsByCurrencyId')->andReturn('110.00');
$this->dateHelperMock->shouldReceive('getDateFormat')->andReturn('22/05/2024');

Expand Down
2 changes: 1 addition & 1 deletion alma/tests/Unit/Helper/TranslationHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public function testGetTranslation()
$translationHelperBuilder = new TranslationHelperBuilder();
$translationHelper = $translationHelperBuilder->getInstance();

$this->assertEquals('Today', $translationHelper->getTranslation('Today', 'PaymentService'));
$this->assertEquals('Today', $translationHelper->l('Today', 'PaymentService'));
}
}
5 changes: 5 additions & 0 deletions alma/translations/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'Alma requires the JSON PHP extension.';
$_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'Alma requires OpenSSL >= 1.0.1';
$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'My wording to translate';
$_MODULE['<{alma}prestashop>translationhelpertest_1dd1c5fb7f25cd41b291d43a89e3aefd'] = 'Today';
$_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'Could not connect to Alma using your API keys.';
$_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Please double check your keys on your %1$sAlma dashboard%2$s.';
$_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Error(s) key(s): %1$s.';
Expand Down Expand Up @@ -139,7 +140,11 @@
$_MODULE['<{alma}prestashop>paymentvalidation_6f11098989b14063e0a4cfe362734850'] = 'Alma - %d monthly installments';
$_MODULE['<{alma}prestashop>refundhelper_446ae76a36687f9dbc62430e7006ca91'] = 'We regret to inform you that there was an issue during the payment process, your Alma payment will be fully refunded. Please retry your payment to complete your order.';
$_MODULE['<{alma}prestashop>refundhelper_448edd2d5c593906afa202847b8d79c0'] = 'We apologize for the inconvenience, but there was an issue during the payment process, and we were unable to refund your Alma payment. To fix this, we kindly ask you to contact our support team with your payment reference: %s. Our team will be happy to assist you in ensuring that you receive your full refund. Thank you for your cooperation.';
$_MODULE['<{alma}prestashop>planhelper_1dd1c5fb7f25cd41b291d43a89e3aefd'] = 'Today';
$_MODULE['<{alma}prestashop>planhelper_96b0141273eabab320119c467cdcaf17'] = 'Total';
$_MODULE['<{alma}prestashop>planhelper_9bbd94e0a507283ae202812ea1bd6f20'] = '%s month later';
$_MODULE['<{alma}prestashop>orderhelper_7960c85fd5916169fc5038a2192094f8'] = 'Error: Could not find Alma transaction';
$_MODULE['<{alma}prestashop>paymentoptiontemplatehelper_9088921432b295dfe6f02863b2dc0ff8'] = '0 € today then %1$s on %2$s';
$_MODULE['<{alma}prestashop>customfieldshelper_2c53dea2326232a2d867ddd1d2206aa0'] = 'Pay now by credit card';
$_MODULE['<{alma}prestashop>customfieldshelper_300de0751d957421cc332ba21c43a598'] = 'Pay in %d installments';
$_MODULE['<{alma}prestashop>customfieldshelper_726c61fad46c135efb4198820e5484ba'] = 'Buy now Pay in %d days';
Expand Down
5 changes: 5 additions & 0 deletions alma/translations/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
$_MODULE['<{alma}prestashop>alma_fbb47375d2272bef79f5722a183bf1ec'] = 'Alma nécessite l\'extension PHP JSON';
$_MODULE['<{alma}prestashop>alma_7fb83ba9cf3cc38857a2ddae98534d22'] = 'Alma nécessite OpenSSL >= 1.0.1';
$_MODULE['<{alma}prestashop>modulefactorytest_5914ca153abaf8a2af61e13e7fe7e829'] = 'Ma formulation à traduire';
$_MODULE['<{alma}prestashop>translationhelpertest_1dd1c5fb7f25cd41b291d43a89e3aefd'] = 'Aujourd\'hui';
$_MODULE['<{alma}prestashop>wrongcredentialsexception_cc76de47de858ac2fa2964f534ecfdfb'] = 'Impossible de se connecter à Alma en utilisant vos clés API.';
$_MODULE['<{alma}prestashop>wrongcredentialsexception_733b6ddadc31fd97174b0cfe69b584c9'] = 'Veuillez vérifier vos clés sur votre tableau de bord %1$sAlma%2$s.';
$_MODULE['<{alma}prestashop>wrongparamsexception_8ec75b5f68c49d1d6541b1e318a8120d'] = 'Clé(s) d\'erreur : %1$s.';
Expand Down Expand Up @@ -134,7 +135,11 @@
$_MODULE['<{alma}prestashop>paymentvalidation_6f11098989b14063e0a4cfe362734850'] = 'Alma - Paiement en %d fois';
$_MODULE['<{alma}prestashop>refundhelper_446ae76a36687f9dbc62430e7006ca91'] = 'Nous avons le regret de vous informer qu\'il y a eu un problème lors du processus de paiement, votre paiement Alma sera entièrement remboursé. Veuillez réessayer votre paiement pour terminer votre commande.';
$_MODULE['<{alma}prestashop>refundhelper_448edd2d5c593906afa202847b8d79c0'] = 'Nous nous excusons pour la gêne occasionnée, mais il y a eu un problème pendant le processus de paiement, et nous n\'avons pas été en mesure de vous rembourser votre paiement Alma. Pour résoudre ce problème, nous vous demandons de contacter notre équipe d\'assistance en indiquant la référence de votre paiement : %s. Notre équipe sera heureuse de vous aider à obtenir le remboursement intégral de votre paiement. Nous vous remercions de votre coopération.';
$_MODULE['<{alma}prestashop>planhelper_1dd1c5fb7f25cd41b291d43a89e3aefd'] = 'Aujourd\'hui';
$_MODULE['<{alma}prestashop>planhelper_96b0141273eabab320119c467cdcaf17'] = 'Total';
$_MODULE['<{alma}prestashop>planhelper_9bbd94e0a507283ae202812ea1bd6f20'] = 'Dans %s mois';
$_MODULE['<{alma}prestashop>orderhelper_7960c85fd5916169fc5038a2192094f8'] = 'Erreur : La transaction Alma n\'a pas pu être récupérée';
$_MODULE['<{alma}prestashop>paymentoptiontemplatehelper_9088921432b295dfe6f02863b2dc0ff8'] = '0 € aujourd\'hui puis %1$s le %2$s';
$_MODULE['<{alma}prestashop>customfieldshelper_2c53dea2326232a2d867ddd1d2206aa0'] = 'Payer maintenant par carte bancaire';
$_MODULE['<{alma}prestashop>customfieldshelper_300de0751d957421cc332ba21c43a598'] = 'Payer en %d fois';
$_MODULE['<{alma}prestashop>customfieldshelper_726c61fad46c135efb4198820e5484ba'] = 'Payer dans %d jours';
Expand Down