minor #31402 [Intl][4.2] Apply localeDisplayPattern and fix locale generation (ro0NL)

This PR was squashed before being merged into the 4.2 branch (closes #31402).

Discussion
----------

[Intl][4.2] Apply localeDisplayPattern and fix locale generation

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Follow up of #31337 for 4.2

Commits
-------

c902c8aea0 recompile
a3164debf8 re-apply translator parents.json generation
294ae7a2b5 [Intl] Apply localeDisplayPattern and fix locale generation
This commit is contained in:
Fabien Potencier 2019-05-07 12:01:00 +02:00
commit 6e8529f82e
2 changed files with 8 additions and 7 deletions

View File

@ -30,7 +30,7 @@ abstract class AbstractDataGenerator
private $compiler;
private $dirName;
public function __construct(BundleCompilerInterface $compiler, $dirName)
public function __construct(BundleCompilerInterface $compiler, string $dirName)
{
$this->compiler = $compiler;
$this->dirName = $dirName;

View File

@ -36,6 +36,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
private $regionDataProvider;
private $locales;
private $localeAliases;
private $localeParents;
private $fallbackMapping;
private $fallbackCache = [];
@ -77,6 +78,12 @@ class LocaleDataGenerator extends AbstractDataGenerator
protected function preGenerate()
{
$this->fallbackCache = [];
// Write parents locale file for the Translation component
\file_put_contents(
__DIR__.'/../../../Translation/Resources/data/parents.json',
\json_encode($this->localeParents, \JSON_PRETTY_PRINT).\PHP_EOL
);
}
/**
@ -134,12 +141,6 @@ class LocaleDataGenerator extends AbstractDataGenerator
if ($localeNames) {
return ['Names' => $localeNames];
}
// Write parents locale file for the Translation component
\file_put_contents(
__DIR__.'/../../../Translation/Resources/data/parents.json',
\json_encode($parents, \JSON_PRETTY_PRINT).\PHP_EOL
);
}
/**