Skip to content
Permalink
Browse files

minor #31337 [Intl] Apply localeDisplayPattern and fix locale generat…

…ion (ro0NL)

This PR was squashed before being merged into the 3.4 branch (closes #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
  • Loading branch information...
fabpot committed May 7, 2019
2 parents 16c460c + a20a6cc commit 7ae5fe033fbeac55d6604c2eb64a5e0e384248ad
Showing with 2,967 additions and 3,018 deletions.
  1. +15 −18 src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php
  2. +6 −6 src/Symfony/Component/Intl/Data/Generator/CurrencyDataGenerator.php
  3. +6 −6 src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php
  4. +110 −128 src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php
  5. +6 −6 src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php
  6. +6 −6 src/Symfony/Component/Intl/Data/Generator/ScriptDataGenerator.php
  7. +4 −35 src/Symfony/Component/Intl/Resources/bin/update-data.php
  8. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/af.json
  9. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/ak.json
  10. +38 −38 src/Symfony/Component/Intl/Resources/data/locales/am.json
  11. +43 −43 src/Symfony/Component/Intl/Resources/data/locales/ar.json
  12. +5 −5 src/Symfony/Component/Intl/Resources/data/locales/ar_SA.json
  13. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/as.json
  14. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/az.json
  15. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/az_Cyrl.json
  16. +20 −20 src/Symfony/Component/Intl/Resources/data/locales/be.json
  17. +13 −13 src/Symfony/Component/Intl/Resources/data/locales/bg.json
  18. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/bn.json
  19. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/br.json
  20. +15 −15 src/Symfony/Component/Intl/Resources/data/locales/bs.json
  21. +10 −10 src/Symfony/Component/Intl/Resources/data/locales/bs_Cyrl.json
  22. +10 −10 src/Symfony/Component/Intl/Resources/data/locales/ca.json
  23. +12 −12 src/Symfony/Component/Intl/Resources/data/locales/ce.json
  24. +19 −19 src/Symfony/Component/Intl/Resources/data/locales/cs.json
  25. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/cy.json
  26. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/da.json
  27. +414 −414 src/Symfony/Component/Intl/Resources/data/locales/dz.json
  28. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/ee.json
  29. +5 −5 src/Symfony/Component/Intl/Resources/data/locales/el.json
  30. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/en.json
  31. +10 −10 src/Symfony/Component/Intl/Resources/data/locales/es.json
  32. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/et.json
  33. +7 −7 src/Symfony/Component/Intl/Resources/data/locales/eu.json
  34. +37 −37 src/Symfony/Component/Intl/Resources/data/locales/fa.json
  35. +18 −18 src/Symfony/Component/Intl/Resources/data/locales/fa_AF.json
  36. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/fi.json
  37. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/fo.json
  38. +5 −5 src/Symfony/Component/Intl/Resources/data/locales/fr.json
  39. +5 −4 src/Symfony/Component/Intl/Resources/data/locales/fr_CA.json
  40. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/fy.json
  41. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/ga.json
  42. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/gd.json
  43. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/gl.json
  44. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/gu.json
  45. +11 −11 src/Symfony/Component/Intl/Resources/data/locales/he.json
  46. +11 −11 src/Symfony/Component/Intl/Resources/data/locales/hi.json
  47. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/hr.json
  48. +7 −7 src/Symfony/Component/Intl/Resources/data/locales/hu.json
  49. +3 −3 src/Symfony/Component/Intl/Resources/data/locales/hy.json
  50. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/id.json
  51. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/is.json
  52. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/it.json
  53. +49 −49 src/Symfony/Component/Intl/Resources/data/locales/ja.json
  54. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/jv.json
  55. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/ka.json
  56. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/kk.json
  57. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/km.json
  58. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/kn.json
  59. +470 −470 src/Symfony/Component/Intl/Resources/data/locales/ko.json
  60. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/ko_KP.json
  61. +5 −5 src/Symfony/Component/Intl/Resources/data/locales/ku.json
  62. +10 −10 src/Symfony/Component/Intl/Resources/data/locales/ky.json
  63. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/lo.json
  64. +4 −4 src/Symfony/Component/Intl/Resources/data/locales/lt.json
  65. +8 −8 src/Symfony/Component/Intl/Resources/data/locales/lv.json
  66. +3 −3 src/Symfony/Component/Intl/Resources/data/locales/mk.json
  67. +11 −11 src/Symfony/Component/Intl/Resources/data/locales/ml.json
  68. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/mn.json
  69. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/mr.json
  70. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/ms.json
  71. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/mt.json
  72. +41 −41 src/Symfony/Component/Intl/Resources/data/locales/my.json
  73. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/nb.json
  74. +7 −7 src/Symfony/Component/Intl/Resources/data/locales/ne.json
  75. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/nl.json
  76. +4 −4 src/Symfony/Component/Intl/Resources/data/locales/nn.json
  77. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/or.json
  78. +17 −17 src/Symfony/Component/Intl/Resources/data/locales/pa.json
  79. +15 −15 src/Symfony/Component/Intl/Resources/data/locales/pl.json
  80. +4 −4 src/Symfony/Component/Intl/Resources/data/locales/ps.json
  81. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/pt.json
  82. +5 −5 src/Symfony/Component/Intl/Resources/data/locales/pt_PT.json
  83. +5 −5 src/Symfony/Component/Intl/Resources/data/locales/qu.json
  84. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/ro.json
  85. +13 −13 src/Symfony/Component/Intl/Resources/data/locales/ru.json
  86. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/rw.json
  87. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/sd.json
  88. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/si.json
  89. +16 −16 src/Symfony/Component/Intl/Resources/data/locales/sk.json
  90. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/sl.json
  91. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/so.json
  92. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/sq.json
  93. +16 −16 src/Symfony/Component/Intl/Resources/data/locales/sr.json
  94. +16 −16 src/Symfony/Component/Intl/Resources/data/locales/sr_Latn.json
  95. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/sv.json
  96. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/sw.json
  97. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/sw_KE.json
  98. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/ta.json
  99. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/te.json
  100. +10 −10 src/Symfony/Component/Intl/Resources/data/locales/tg.json
  101. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/th.json
  102. +4 −4 src/Symfony/Component/Intl/Resources/data/locales/ti.json
  103. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/tk.json
  104. +4 −4 src/Symfony/Component/Intl/Resources/data/locales/to.json
  105. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/tr.json
  106. +16 −16 src/Symfony/Component/Intl/Resources/data/locales/tt.json
  107. +41 −41 src/Symfony/Component/Intl/Resources/data/locales/ug.json
  108. +7 −7 src/Symfony/Component/Intl/Resources/data/locales/uk.json
  109. +38 −38 src/Symfony/Component/Intl/Resources/data/locales/ur.json
  110. +1 −1 src/Symfony/Component/Intl/Resources/data/locales/ur_IN.json
  111. +11 −11 src/Symfony/Component/Intl/Resources/data/locales/uz.json
  112. +11 −11 src/Symfony/Component/Intl/Resources/data/locales/uz_Cyrl.json
  113. +7 −7 src/Symfony/Component/Intl/Resources/data/locales/vi.json
  114. +9 −9 src/Symfony/Component/Intl/Resources/data/locales/wo.json
  115. +468 −468 src/Symfony/Component/Intl/Resources/data/locales/zh.json
  116. +467 −467 src/Symfony/Component/Intl/Resources/data/locales/zh_Hant.json
  117. +199 −199 src/Symfony/Component/Intl/Resources/data/locales/zh_Hant_HK.json
  118. +2 −2 src/Symfony/Component/Intl/Resources/data/locales/zu.json
@@ -12,8 +12,9 @@
namespace Symfony\Component\Intl\Data\Generator;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Intl\Data\Bundle\Compiler\GenrbCompiler;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface;
use Symfony\Component\Intl\Data\Bundle\Compiler\BundleCompilerInterface;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
use Symfony\Component\Intl\Data\Bundle\Reader\IntlBundleReader;
use Symfony\Component\Intl\Data\Util\LocaleScanner;
@@ -29,7 +30,7 @@ abstract class AbstractDataGenerator
private $compiler;
private $dirName;
public function __construct(GenrbCompiler $compiler, $dirName)
public function __construct(BundleCompilerInterface $compiler, $dirName)
{
$this->compiler = $compiler;
$this->dirName = (string) $dirName;
@@ -39,7 +40,7 @@ public function generateData(GeneratorConfig $config)
{
$filesystem = new Filesystem();
$localeScanner = new LocaleScanner();
$reader = new IntlBundleReader();
$reader = new BundleEntryReader(new IntlBundleReader());
$writers = $config->getBundleWriters();
$tempDir = sys_get_temp_dir().'/icu-data-'.$this->dirName;
@@ -98,36 +99,32 @@ public function generateData(GeneratorConfig $config)
abstract protected function scanLocales(LocaleScanner $scanner, $sourceDir);
/**
* @param GenrbCompiler $compiler
* @param string $sourceDir
* @param string $tempDir
* @param string $sourceDir
* @param string $tempDir
*/
abstract protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir);
abstract protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir);
abstract protected function preGenerate();
/**
* @param BundleReaderInterface $reader
* @param string $tempDir
* @param string $displayLocale
* @param string $tempDir
* @param string $displayLocale
*
* @return array|null
*/
abstract protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale);
abstract protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale);
/**
* @param BundleReaderInterface $reader
* @param string $tempDir
* @param string $tempDir
*
* @return array|null
*/
abstract protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir);
abstract protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir);
/**
* @param BundleReaderInterface $reader
* @param string $tempDir
* @param string $tempDir
*
* @return array|null
*/
abstract protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir);
abstract protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir);
}
@@ -11,8 +11,8 @@
namespace Symfony\Component\Intl\Data\Generator;
use Symfony\Component\Intl\Data\Bundle\Compiler\GenrbCompiler;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface;
use Symfony\Component\Intl\Data\Bundle\Compiler\BundleCompilerInterface;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
use Symfony\Component\Intl\Data\Util\ArrayAccessibleResourceBundle;
use Symfony\Component\Intl\Data\Util\LocaleScanner;
@@ -59,7 +59,7 @@ protected function scanLocales(LocaleScanner $scanner, $sourceDir)
/**
* {@inheritdoc}
*/
protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir)
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
{
$compiler->compile($sourceDir.'/curr', $tempDir);
$compiler->compile($sourceDir.'/misc/currencyNumericCodes.txt', $tempDir);
@@ -76,7 +76,7 @@ protected function preGenerate()
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale)
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale)
{
$localeBundle = $reader->read($tempDir, $displayLocale);
@@ -95,7 +95,7 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir)
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir)
{
$rootBundle = $reader->read($tempDir, 'root');
@@ -108,7 +108,7 @@ protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir)
/**
* {@inheritdoc}
*/
protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir)
{
$rootBundle = $reader->read($tempDir, 'root');
$supplementalDataBundle = $reader->read($tempDir, 'supplementalData');
@@ -11,8 +11,8 @@
namespace Symfony\Component\Intl\Data\Generator;
use Symfony\Component\Intl\Data\Bundle\Compiler\GenrbCompiler;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleReaderInterface;
use Symfony\Component\Intl\Data\Bundle\Compiler\BundleCompilerInterface;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReaderInterface;
use Symfony\Component\Intl\Data\Util\ArrayAccessibleResourceBundle;
use Symfony\Component\Intl\Data\Util\LocaleScanner;
use Symfony\Component\Intl\Exception\RuntimeException;
@@ -102,7 +102,7 @@ protected function scanLocales(LocaleScanner $scanner, $sourceDir)
/**
* {@inheritdoc}
*/
protected function compileTemporaryBundles(GenrbCompiler $compiler, $sourceDir, $tempDir)
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
{
$compiler->compile($sourceDir.'/lang', $tempDir);
$compiler->compile($sourceDir.'/misc/metadata.txt', $tempDir);
@@ -119,7 +119,7 @@ protected function preGenerate()
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale)
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale)
{
$localeBundle = $reader->read($tempDir, $displayLocale);
@@ -139,14 +139,14 @@ protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleReaderInterface $reader, $tempDir)
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir)
{
}
/**
* {@inheritdoc}
*/
protected function generateDataForMeta(BundleReaderInterface $reader, $tempDir)
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir)
{
$rootBundle = $reader->read($tempDir, 'root');
$metadataBundle = $reader->read($tempDir, 'metadata');
Oops, something went wrong.

0 comments on commit 7ae5fe0

Please sign in to comment.
You can’t perform that action at this time.