Place this repository in /app/code/HyvaCamp/I18n
.
Patch the following files until we find out how to do this properly:
diff --git a/setup/src/Magento/Setup/Module/I18n/ServiceLocator.php b/setup/src/Magento/Setup/Module/I18n/ServiceLocator.php
index a3964d7d..9c4773c0 100644
--- a/setup/src/Magento/Setup/Module/I18n/ServiceLocator.php
+++ b/setup/src/Magento/Setup/Module/I18n/ServiceLocator.php
@@ -50,13 +50,13 @@ class ServiceLocator
{
if (null === self::$_dictionaryGenerator) {
$filesCollector = new FilesCollector();
-
$phraseCollector = new Parser\Adapter\Php\Tokenizer\PhraseCollector(new Parser\Adapter\Php\Tokenizer());
$adapters = [
'php' => new Parser\Adapter\Php($phraseCollector),
'html' => new Parser\Adapter\Html(),
'js' => new Parser\Adapter\Js(),
'xml' => new Parser\Adapter\Xml(),
+ 'json' => new \HyvaCamp\I18n\Parser\Adapter\Json(),
];
$parser = new Parser\Parser($filesCollector, self::_getFactory());
diff --git a/setup/src/Magento/Setup/Module/I18n/Dictionary/Options/Resolver.php b/setup/src/Magento/Setup/Module/I18n/Dictionary/Options/Resolver.php
index 2f58b5fe..11817298 100644
--- a/setup/src/Magento/Setup/Module/I18n/Dictionary/Options/Resolver.php
+++ b/setup/src/Magento/Setup/Module/I18n/Dictionary/Options/Resolver.php
@@ -90,6 +90,11 @@ class Resolver implements ResolverInterface
'paths' => array_merge($moduleDirs, $themeDirs),
'fileMask' => '/\.xml$/'
],
+ [
+ 'type' => 'json',
+ 'paths' => array_merge($moduleDirs, $themeDirs),
+ 'fileMask' => '/\.json$/'
+ ],
];
} else {
$this->options = [
@@ -97,6 +102,7 @@ class Resolver implements ResolverInterface
['type' => 'html', 'paths' => [$this->directory], 'fileMask' => '/\.html/'],
['type' => 'js', 'paths' => [$this->directory], 'fileMask' => '/\.(js|phtml)$/'],
['type' => 'xml', 'paths' => [$this->directory], 'fileMask' => '/\.xml$/'],
+ ['type' => 'json', 'paths' => [$this->directory], 'fileMask' => '/\.json$/'],
];
}
foreach ($this->options as $option) {
Collect phrases (e.g. just inside hyva cms module):
php bin/magento i18n:collect-phrases vendor/hyva-themes/commerce-module-cms/src/components-base/etc/hyva_cms/