Skip to content

Commit 1cbb5f2

Browse files
committed
re-apply translator parents.json generation
1 parent 01eaf80 commit 1cbb5f2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Data/Generator/LocaleDataGenerator.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
3636
private $regionDataProvider;
3737
private $locales;
3838
private $localeAliases;
39+
private $localeParents;
3940
private $fallbackMapping;
4041
private $fallbackCache = [];
4142

@@ -55,6 +56,7 @@ protected function scanLocales(LocaleScanner $scanner, $sourceDir)
5556
{
5657
$this->locales = $scanner->scanLocales($sourceDir.'/locales');
5758
$this->localeAliases = $scanner->scanAliases($sourceDir.'/locales');
59+
$this->localeParents = $scanner->scanParents($sourceDir.'/locales');
5860
$this->fallbackMapping = $this->generateFallbackMapping(array_diff($this->locales, array_keys($this->localeAliases)), $this->localeAliases);
5961

6062
return $this->locales;
@@ -76,6 +78,12 @@ protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $s
7678
protected function preGenerate()
7779
{
7880
$this->fallbackCache = [];
81+
82+
// Write parents locale file for the Translation component
83+
\file_put_contents(
84+
__DIR__.'/../../../Translation/Resources/data/parents.json',
85+
\json_encode($this->localeParents, \JSON_PRETTY_PRINT).\PHP_EOL
86+
);
7987
}
8088

8189
/**
@@ -133,12 +141,6 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, $te
133141
if ($localeNames) {
134142
return ['Names' => $localeNames];
135143
}
136-
137-
// Write parents locale file for the Translation component
138-
\file_put_contents(
139-
__DIR__.'/../../../Translation/Resources/data/parents.json',
140-
\json_encode($parents, \JSON_PRETTY_PRINT).\PHP_EOL
141-
);
142144
}
143145

144146
/**

0 commit comments

Comments
 (0)