Skip to content

Commit 56cfe16

Browse files
committed
MAGETWO-34390: Stabilization of replacing Zend_Locale with Native PHP Implementation
1 parent e33f96c commit 56cfe16

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

app/code/Magento/Dhl/Setup/InstallData.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\Dhl\Setup;
88

9-
use Magento\Framework\Locale\ListsInterface;
9+
use Magento\Framework\Locale\ResolverInterface;
1010
use Magento\Framework\Setup\InstallDataInterface;
1111
use Magento\Framework\Setup\ModuleContextInterface;
1212
use Magento\Framework\Setup\ModuleDataSetupInterface;
@@ -19,31 +19,29 @@ class InstallData implements InstallDataInterface
1919
/**
2020
* Locale list
2121
*
22-
* @var ListsInterface
22+
* @var ResolverInterface
2323
*/
24-
private $localeLists;
24+
private $localeResolver;
2525

2626
/**
2727
* Init
2828
*
29-
* @param ListsInterface $localeLists
29+
* @param ResolverInterface $localeResolver
3030
*/
31-
public function __construct(ListsInterface $localeLists)
31+
public function __construct(ResolverInterface $localeResolver)
3232
{
33-
$this->localeLists = $localeLists;
33+
$this->localeResolver = $localeResolver;
3434
}
3535

3636
/**
3737
* {@inheritdoc}
3838
*/
3939
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
4040
{
41-
$days = $this->localeLists->getTranslationList('days');
42-
43-
$days = array_keys($days['format']['wide']);
44-
foreach ($days as $key => $value) {
45-
$days[$key] = ucfirst($value);
46-
}
41+
$days = (new \ResourceBundle(
42+
$this->localeResolver->getLocale(),
43+
'ICUDATA'
44+
))['calendar']['gregorian']['dayNames']['format']['abbreviated'];
4745

4846
$select = $setup->getConnection()->select()->from(
4947
$setup->getTable('core_config_data'),
@@ -54,7 +52,12 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
5452
);
5553

5654
foreach ($setup->getConnection()->fetchAll($select) as $configRow) {
57-
$row = ['value' => implode(',', array_intersect_key($days, array_flip(explode(',', $configRow['value']))))];
55+
$row = [
56+
'value' => implode(
57+
',',
58+
array_intersect_key(iterator_to_array($days), array_flip(explode(',', $configRow['value'])))
59+
)
60+
];
5861
$setup->getConnection()->update(
5962
$setup->getTable('core_config_data'),
6063
$row,

0 commit comments

Comments
 (0)