File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
app/code/Magento/Translation/view/base/templates
dev/tests/js/jasmine/tests/lib/mage Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
/** @var \Magento\Translation\ViewModel\Dictionary $viewModel */
8
8
$ viewModel = $ block ->getData ('dictionary_view_model ' );
9
+ $ dictionary = json_encode ($ viewModel ->getTranslationDictionary (), JSON_HEX_APOS | JSON_UNESCAPED_SLASHES );
9
10
?>
10
11
<script>
11
12
define('dictionary', function () {
12
- return <?= /* @noEscape */ $ viewModel ->getTranslationDictionary () ?> ;
13
+ var dict = <?= /* @noEscape */ $ dictionary ?> ;
14
+ // Use of JSON.parse is intentional as JSON is significantly faster to parse than JavaScript
15
+ return JSON.parse(dict);
13
16
});
14
17
</script>
Original file line number Diff line number Diff line change 2
2
* Copyright © Magento, Inc. All rights reserved.
3
3
* See COPYING.txt for license details.
4
4
*/
5
- // Fake dictionary for js unit tests as real dictionary is defined is template and cannot be initialized by requirejs
5
+ // Fake dictionary for js unit tests as real dictionary is defined in template and cannot be initialized by requirejs
6
6
define ( [ ] , function ( ) {
7
7
'use strict' ;
8
8
You can’t perform that action at this time.
0 commit comments