@@ -36,6 +36,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
36
36
private $ regionDataProvider ;
37
37
private $ locales ;
38
38
private $ localeAliases ;
39
+ private $ localeParents ;
39
40
private $ fallbackMapping ;
40
41
private $ fallbackCache = [];
41
42
@@ -55,6 +56,7 @@ protected function scanLocales(LocaleScanner $scanner, $sourceDir)
55
56
{
56
57
$ this ->locales = $ scanner ->scanLocales ($ sourceDir .'/locales ' );
57
58
$ this ->localeAliases = $ scanner ->scanAliases ($ sourceDir .'/locales ' );
59
+ $ this ->localeParents = $ scanner ->scanParents ($ sourceDir .'/locales ' );
58
60
$ this ->fallbackMapping = $ this ->generateFallbackMapping (array_diff ($ this ->locales , array_keys ($ this ->localeAliases )), $ this ->localeAliases );
59
61
60
62
return $ this ->locales ;
@@ -76,6 +78,12 @@ protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $s
76
78
protected function preGenerate ()
77
79
{
78
80
$ 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
+ );
79
87
}
80
88
81
89
/**
@@ -133,12 +141,6 @@ protected function generateDataForLocale(BundleEntryReaderInterface $reader, $te
133
141
if ($ localeNames ) {
134
142
return ['Names ' => $ localeNames ];
135
143
}
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
- );
142
144
}
143
145
144
146
/**
0 commit comments