Skip to content

Commit

Permalink
Merge pull request #165 in PLUG_OPEN/swagpaymentpaypalunified from pt…
Browse files Browse the repository at this point in the history
…-9947/5.2/add-right-locales-for-german-speaking-countries to master

* commit 'efc4d454197bb012fb137d9d52454186bb0ff0ee':
  PT-9947 - Add right locales for german speaking countries
  • Loading branch information
mitelg committed Dec 11, 2018
2 parents f935743 + efc4d45 commit 9fa4577
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
18 changes: 1 addition & 17 deletions Components/Services/PaymentBuilderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private function getApplicationContext($paymentType)
$applicationContext = new ApplicationContext();

$applicationContext->setBrandName($this->getBrandName());
$applicationContext->setLocale($this->getLocale());
$applicationContext->setLocale($this->dependencyProvider->getShop()->getLocale()->getLocale());
$applicationContext->setLandingPage($this->getLandingPage());

if ($paymentType === PaymentType::PAYPAL_EXPRESS) {
Expand All @@ -367,22 +367,6 @@ private function getApplicationContext($paymentType)
return $applicationContext;
}

/**
* Returns the locale as a 5 digit ISO code
*
* @return string
*/
private function getLocale()
{
$locale = $this->dependencyProvider->getShop()->getLocale()->getLocale();

if (strpos($locale, 'de_') === 0) {
$locale = 'de_DE';
}

return $locale;
}

/**
* @return string
*/
Expand Down
8 changes: 1 addition & 7 deletions Subscriber/ExpressCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,6 @@ private function patchAddressAndAmount($paymentId)
*/
private function getExpressCheckoutButtonLanguage()
{
$languageIso = $this->dependencyProvider->getShop()->getLocale()->getLocale();

if (strncmp($languageIso, 'de_', 3) === 0) {
$languageIso = 'de_DE';
}

return $languageIso;
return $this->dependencyProvider->getShop()->getLocale()->getLocale();
}
}
16 changes: 1 addition & 15 deletions Subscriber/InContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function addInContextButton(\Enlight_Controller_ActionEventArgs $args)
$view->assign('paypalUnifiedEcButtonStyleColor', $expressSettings->getButtonStyleColor());
$view->assign('paypalUnifiedEcButtonStyleShape', $expressSettings->getButtonStyleShape());
$view->assign('paypalUnifiedEcButtonStyleSize', $expressSettings->getButtonStyleSize());
$view->assign('paypalUnifiedLanguageIso', $this->getExpressCheckoutButtonLanguage());
$view->assign('paypalUnifiedLanguageIso', $this->dependencyProvider->getShop()->getLocale()->getLocale());
}

/**
Expand All @@ -125,18 +125,4 @@ public function addInContextInfoToRequest(\Enlight_Controller_ActionEventArgs $a
]);
}
}

/**
* @return string
*/
private function getExpressCheckoutButtonLanguage()
{
$languageIso = $this->dependencyProvider->getShop()->getLocale()->getLocale();

if (strpos($languageIso, 'de_') === 0) {
$languageIso = 'de_DE';
}

return $languageIso;
}
}

0 comments on commit 9fa4577

Please sign in to comment.