Skip to content

Commit aee517e

Browse files
committed
MC-19247: Broken translations with advanced bundling
- Move translation dictionary to separate js;
1 parent 1ded109 commit aee517e

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,4 @@ if (!$viewModel->isAppStateProduction()) {
1717
});
1818
</script>
1919
<?php
20-
} else {
21-
?>
22-
<script>
23-
define('mageTranslationDictionary', ['text!<?= $viewModel->escapeUrl($viewModel->getTranslationDictionaryUrl()) ?>'], function (dict) {
24-
return JSON.parse(dict);
25-
});
26-
</script>
27-
<?php
2820
}
29-
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
define(['text!js-translation.json'],
7+
function (dict) {
8+
return JSON.parse(dict);
9+
});

app/code/Magento/Translation/view/frontend/requirejs-config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ var config = {
88
'*': {
99
editTrigger: 'mage/edit-trigger',
1010
addClass: 'Magento_Translation/js/add-class',
11-
'Magento_Translation/add-class': 'Magento_Translation/js/add-class'
11+
'Magento_Translation/add-class': 'Magento_Translation/js/add-class',
12+
mageTranslationDictionary: 'Magento_Translation/js/mageTranslationDictionary'
1213
}
1314
},
1415
deps: [
15-
'mage/translate-inline'
16+
'mage/translate-inline',
17+
'mageTranslationDictionary'
1618
]
1719
};

0 commit comments

Comments
 (0)