Skip to content

Commit 7ae5fe0

Browse files
committed
minor symfony#31337 [Intl] Apply localeDisplayPattern and fix locale generation (ro0NL)
This PR was squashed before being merged into the 3.4 branch (closes symfony#31337). Discussion ---------- [Intl] Apply localeDisplayPattern and fix locale generation | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no (few data changes) | Deprecations? | no | Tests pass? | yes (including intl-data group) | Fixed tickets | #... <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> See https://github.com/unicode-org/icu/blob/e2d85306162d3a0691b070b4f0a73e4012433444/icu4c/source/data/lang/en.txt#L1281-L1285 Technically, this should be applied here: https://github.com/symfony/symfony/blob/2b923a7c03e1ed1540c9dba224242defd9aa75cd/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php#L211 This PR aims to implement it, but before it got to this point i noticed a false positive during generation (AFAIK). The current state solves this issue first. While at it, i cleaned up dead-code in `update-data.php` to reduce the noise. Commits ------- a20a6cc recompile 29e8aba [Intl] Apply localeDisplayPattern and fix locale generation
2 parents 16c460c + a20a6cc commit 7ae5fe0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+2967
-3018
lines changed

src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
namespace Symfony\Component\Intl\Data\Generator;
1313

1414
use Symfony\Component\Filesystem\Filesystem;
15-
use Symfony\Component\Intl\Data\Bundle\Compiler\GenrbCompiler;
16-
use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface;
15+
use Symfony\Component\Intl\Data\Bundle\Compiler\BundleCompilerInterface;
16+
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader;
17+
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
1718
use Symfony\Component\Intl\Data\Bundle\Reader\IntlBundleReader;
1819
use Symfony\Component\Intl\Data\Util\LocaleScanner;
1920

@@ -29,7 +30,7 @@ abstract class AbstractDataGenerator
2930
private $compiler;
3031
private $dirName;
3132

32-
public function __construct(GenrbCompiler $compiler, $dirName)
33+
public function __construct(BundleCompilerInterface $compiler, $dirName)
3334
{
3435
$this->compiler = $compiler;
3536
$this->dirName = (string) $dirName;
@@ -39,7 +40,7 @@ public function generateData(GeneratorConfig $config)
3940
{
4041
$filesystem = new Filesystem();
4142
$localeScanner = new LocaleScanner();
42-
$reader = new IntlBundleReader();
43+
$reader = new BundleEntryReader(new IntlBundleReader());
4344

4445
$writers = $config->getBundleWriters();
4546
$tempDir = sys_get_temp_dir().'/icu-data-'.$this->dirName;
@@ -98,36 +99,32 @@ public function generateData(GeneratorConfig $config)
9899
abstract protected function scanLocales(LocaleScanner $scanner, $sourceDir);
99100

100101
/**
101-
* @param GenrbCompiler $compiler
102-
* @param string $sourceDir
103-
* @param string $tempDir
102+
* @param string $sourceDir
103+
* @param string $tempDir
104104
*/
105-
abstract protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir);
105+
abstract protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir);
106106

107107
abstract protected function preGenerate();
108108

109109
/**
110-
* @param BundleReaderInterface $reader
111-
* @param string $tempDir
112-
* @param string $displayLocale
110+
* @param string $tempDir
111+
* @param string $displayLocale
113112
*
114113
* @return array|null
115114
*/
116-
abstract protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale);
115+
abstract protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale);
117116

118117
/**
119-
* @param BundleReaderInterface $reader
120-
* @param string $tempDir
118+
* @param string $tempDir
121119
*
122120
* @return array|null
123121
*/
124-
abstract protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir);
122+
abstract protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir);
125123

126124
/**
127-
* @param BundleReaderInterface $reader
128-
* @param string $tempDir
125+
* @param string $tempDir
129126
*
130127
* @return array|null
131128
*/
132-
abstract protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir);
129+
abstract protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir);
133130
}

src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Intl\Data\Generator;
1313

14-
use Symfony\Component\Intl\Data\Bundle\Compiler\GenrbCompiler;
15-
use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface;
14+
use Symfony\Component\Intl\Data\Bundle\Compiler\BundleCompilerInterface;
15+
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
1616
use Symfony\Component\Intl\Data\Util\ArrayAccessibleResourceBundle;
1717
use Symfony\Component\Intl\Data\Util\LocaleScanner;
1818

@@ -59,7 +59,7 @@ protected function scanLocales(LocaleScanner $scanner, $sourceDir)
5959
/**
6060
* {@inheritdoc}
6161
*/
62-
protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir)
62+
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
6363
{
6464
$compiler->compile($sourceDir.'/curr', $tempDir);
6565
$compiler->compile($sourceDir.'/misc/currencyNumericCodes.txt', $tempDir);
@@ -76,7 +76,7 @@ protected function preGenerate()
7676
/**
7777
* {@inheritdoc}
7878
*/
79-
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale)
79+
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale)
8080
{
8181
$localeBundle = $reader->read($tempDir, $displayLocale);
8282

@@ -95,7 +95,7 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
9595
/**
9696
* {@inheritdoc}
9797
*/
98-
protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir)
98+
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir)
9999
{
100100
$rootBundle = $reader->read($tempDir, 'root');
101101

@@ -108,7 +108,7 @@ protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir)
108108
/**
109109
* {@inheritdoc}
110110
*/
111-
protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
111+
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir)
112112
{
113113
$rootBundle = $reader->read($tempDir, 'root');
114114
$supplementalDataBundle = $reader->read($tempDir, 'supplementalData');

src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Intl\Data\Generator;
1313

14-
use Symfony\Component\Intl\Data\Bundle\Compiler\GenrbCompiler;
15-
use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface;
14+
use Symfony\Component\Intl\Data\Bundle\Compiler\BundleCompilerInterface;
15+
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
1616
use Symfony\Component\Intl\Data\Util\ArrayAccessibleResourceBundle;
1717
use Symfony\Component\Intl\Data\Util\LocaleScanner;
1818
use Symfony\Component\Intl\Exception\RuntimeException;
@@ -102,7 +102,7 @@ protected function scanLocales(LocaleScanner $scanner, $sourceDir)
102102
/**
103103
* {@inheritdoc}
104104
*/
105-
protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir)
105+
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
106106
{
107107
$compiler->compile($sourceDir.'/lang', $tempDir);
108108
$compiler->compile($sourceDir.'/misc/metadata.txt', $tempDir);
@@ -119,7 +119,7 @@ protected function preGenerate()
119119
/**
120120
* {@inheritdoc}
121121
*/
122-
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale)
122+
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale)
123123
{
124124
$localeBundle = $reader->read($tempDir, $displayLocale);
125125

@@ -139,14 +139,14 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
139139
/**
140140
* {@inheritdoc}
141141
*/
142-
protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir)
142+
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir)
143143
{
144144
}
145145

146146
/**
147147
* {@inheritdoc}
148148
*/
149-
protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
149+
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir)
150150
{
151151
$rootBundle = $reader->read($tempDir, 'root');
152152
$metadataBundle = $reader->read($tempDir, 'metadata');

0 commit comments

Comments
 (0)