Skip to content

Commit ace297a

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #19365: Fixing a test for Magento Newsletter. (by @tiagosampaio) - #19358: [Backport] Fix the issue with repetitive "tbody" tag for order items table (by @gelanivishal) - #19023: [2.2 develop] [backport #19018] [issue #17833] child theme does not inherit translations from parent theme (by @vpodorozh) Fixed GitHub Issues: - #17833: Child theme does not inherit translations from parent theme (reported by @rossmc) has been fixed in #19023 by @vpodorozh in 2.2-develop branch Related commits: 1. caa2fe8 2. 24330d6 3. 10d9cc9 4. a3db8d3 5. 26ea51e 6. e8a07c9
2 parents c59e602 + 38d14a0 commit ace297a

File tree

4 files changed

+77
-10
lines changed

4 files changed

+77
-10
lines changed

app/code/Magento/Newsletter/Test/Unit/Model/ProblemTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ protected function setUp()
6868
->disableOriginalConstructor()
6969
->getMock();
7070
$this->subscriberFactoryMock = $this->getMockBuilder(SubscriberFactory::class)
71+
->disableOriginalConstructor()
7172
->getMock();
7273
$this->subscriberMock = $this->getMockBuilder(Subscriber::class)
7374
->disableOriginalConstructor()

app/code/Magento/Sales/view/frontend/templates/order/items.phtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
</thead>
3030
<?php $items = $block->getItems(); ?>
3131
<?php $giftMessage = ''?>
32+
<tbody>
3233
<?php foreach ($items as $item): ?>
3334
<?php if ($item->getParentItem()) continue; ?>
34-
<tbody>
35+
3536
<?= $block->getItemHtml($item) ?>
3637
<?php if ($this->helper('Magento\GiftMessage\Helper\Message')->isMessagesAllowed('order_item', $item) && $item->getGiftMessageId()): ?>
3738
<?php $giftMessage = $this->helper('Magento\GiftMessage\Helper\Message')->getGiftMessageForEntity($item); ?>
@@ -62,8 +63,8 @@
6263
</td>
6364
</tr>
6465
<?php endif ?>
65-
</tbody>
6666
<?php endforeach; ?>
67+
</tbody>
6768
<tfoot>
6869
<?php if($block->isPagerDisplayed()): ?>
6970
<tr>

app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,6 @@
612612
padding: 25px;
613613

614614
.col {
615-
&.name {
616-
padding-left: 0;
617-
}
618-
619615
&.price {
620616
text-align: center;
621617
}

lib/internal/Magento/Framework/Translate.php

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Framework;
89

@@ -327,16 +328,21 @@ protected function _addData($data)
327328
}
328329

329330
/**
330-
* Load current theme translation
331+
* Load current theme translation according to fallback
331332
*
332333
* @return $this
333334
*/
334335
protected function _loadThemeTranslation()
335336
{
336-
$file = $this->_getThemeTranslationFile($this->getLocale());
337-
if ($file) {
338-
$this->_addData($this->_getFileData($file));
337+
$themeFiles = $this->getThemeTranslationFilesList($this->getLocale());
338+
339+
/** @var string $file */
340+
foreach ($themeFiles as $file) {
341+
if ($file) {
342+
$this->_addData($this->_getFileData($file));
343+
}
339344
}
345+
340346
return $this;
341347
}
342348

@@ -377,11 +383,74 @@ protected function _getModuleTranslationFile($moduleName, $locale)
377383
return $file;
378384
}
379385

386+
/**
387+
* Get theme translation locale file name
388+
*
389+
* @param string|null $locale
390+
* @param array $config
391+
* @return string|null
392+
*/
393+
private function getThemeTranslationFileName($locale, array $config)
394+
{
395+
$fileName = $this->_viewFileSystem->getLocaleFileName(
396+
'i18n' . '/' . $locale . '.csv',
397+
$config
398+
);
399+
400+
return $fileName ? $fileName : null;
401+
}
402+
403+
/**
404+
* Get parent themes for the current theme in fallback order
405+
*
406+
* @return array
407+
*/
408+
private function getParentThemesList(): array
409+
{
410+
$themes = [];
411+
412+
$parentTheme = $this->_viewDesign->getDesignTheme()->getParentTheme();
413+
while ($parentTheme) {
414+
$themes[] = $parentTheme;
415+
$parentTheme = $parentTheme->getParentTheme();
416+
}
417+
$themes = array_reverse($themes);
418+
419+
return $themes;
420+
}
421+
422+
/**
423+
* Retrieve translation files for themes according to fallback
424+
*
425+
* @param string $locale
426+
*
427+
* @return array
428+
*/
429+
private function getThemeTranslationFilesList($locale): array
430+
{
431+
$translationFiles = [];
432+
433+
/** @var \Magento\Framework\View\Design\ThemeInterface $theme */
434+
foreach ($this->getParentThemesList() as $theme) {
435+
$config = $this->_config;
436+
$config['theme'] = $theme->getCode();
437+
$translationFiles[] = $this->getThemeTranslationFileName($locale, $config);
438+
}
439+
440+
$translationFiles[] = $this->getThemeTranslationFileName($locale, $this->_config);
441+
442+
return $translationFiles;
443+
}
444+
380445
/**
381446
* Retrieve translation file for theme
382447
*
383448
* @param string $locale
384449
* @return string
450+
*
451+
* @deprecated
452+
*
453+
* @see \Magento\Framework\Translate::getThemeTranslationFilesList
385454
*/
386455
protected function _getThemeTranslationFile($locale)
387456
{

0 commit comments

Comments
 (0)