Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -29,7 +30,7 @@ abstract class AbstractDataGenerator
private $compiler;
private $dirName;

public function __construct(GenrbCompiler $compiler, string $dirName)
public function __construct(BundleCompilerInterface $compiler, string $dirName)
{
$this->compiler = $compiler;
$this->dirName = $dirName;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand All @@ -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);

Expand All @@ -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');

Expand All @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -108,7 +108,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);
Expand All @@ -125,7 +125,7 @@ protected function preGenerate()
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleReaderInterface $reader, $tempDir, $displayLocale)
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale)
{
$localeBundle = $reader->read($tempDir, $displayLocale);

Expand All @@ -145,14 +145,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');
Expand Down
Loading