Skip to content

Commit a1dab12

Browse files
committed
Improved calculating version hash for the js-translation.json file.
1 parent eb31731 commit a1dab12

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

app/code/Magento/Translation/Block/Js.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,12 @@ public function getTranslationFilePath()
6868
{
6969
return $this->fileManager->getTranslationFilePath();
7070
}
71+
72+
/**
73+
* @return string
74+
*/
75+
public function getTranslationFileFullPath()
76+
{
77+
return $this->fileManager->getTranslationFileFullPath();
78+
}
7179
}

app/code/Magento/Translation/Model/FileManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function getTranslationFileTimestamp()
7373
/**
7474
* @return string
7575
*/
76-
protected function getTranslationFileFullPath()
76+
public function getTranslationFileFullPath()
7777
{
7878
return $this->directoryList->getPath(DirectoryList::STATIC_VIEW) .
7979
\DIRECTORY_SEPARATOR .

app/code/Magento/Translation/view/base/templates/translate.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
$.initNamespaceStorage('mage-translation-file-version');
2727
versionObj = $.localStorage.get('mage-translation-file-version');
2828

29-
<?php $version = sha1($block->getTranslationFileTimestamp() . $block->getTranslationFilePath()); ?>
29+
<?php $version = sha1(sha1_file($block->getTranslationFileFullPath()) . $block->getTranslationFilePath()); ?>
3030

3131
if (versionObj.version !== '<?= /* @noEscape */ $version ?>') {
3232
dependencies.push(

0 commit comments

Comments
 (0)