feature #14156 Remove deprecated Locale component (stloyd)

This PR was merged into the 3.0-dev branch.

Discussion
----------

Remove deprecated Locale component

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

Commits
-------

4c57e77 Remove deprecated Locale component
This commit is contained in:
Fabien Potencier 2015-04-02 08:43:01 +02:00
commit 0409baa198
36 changed files with 0 additions and 1271 deletions

View File

@ -42,7 +42,6 @@
"symfony/http-foundation": "self.version",
"symfony/http-kernel": "self.version",
"symfony/intl": "self.version",
"symfony/locale": "self.version",
"symfony/monolog-bridge": "self.version",
"symfony/options-resolver": "self.version",
"symfony/process": "2.99.99",

View File

@ -1,3 +0,0 @@
vendor/
composer.lock
phpunit.xml

View File

@ -1,15 +0,0 @@
CHANGELOG
=========
2.3.0
-----
The Locale component is deprecated since version 2.3 and will be removed in
Symfony 3.0. You should use the more capable Intl component instead.
2.1.0
-----
* added Locale::getIntlIcuVersion(), Locale::getIntlIcuDataVersion(), Locale::getIcuDataVersion() and Locale::getIcuDataDirectory()
* renamed update-data.php to build-data.php, the script usage changed, now it is easier to update the ICU data
* updated the ICU data to the release 49.1.2

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Exception;
trigger_error('The '.__NAMESPACE__.'\MethodArgumentNotImplementedException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException as BaseMethodArgumentNotImplementedException;
/**
* Alias of {@link \Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\Exception\MethodArgumentNotImplementedException}
* instead.
*/
class MethodArgumentNotImplementedException extends BaseMethodArgumentNotImplementedException
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Exception;
trigger_error('The '.__NAMESPACE__.'\MethodArgumentValueNotImplementedException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException as BaseMethodArgumentValueNotImplementedException;
/**
* Alias of {@link \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException}
* instead.
*/
class MethodArgumentValueNotImplementedException extends BaseMethodArgumentValueNotImplementedException
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Exception;
trigger_error('The '.__NAMESPACE__.'\MethodNotImplementedException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\Exception\MethodNotImplementedException class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\Exception\MethodNotImplementedException as BaseMethodNotImplementedException;
/**
* Alias of {@link \Symfony\Component\Intl\Exception\MethodNotImplementedException}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\Exception\MethodNotImplementedException}
* instead.
*/
class MethodNotImplementedException extends BaseMethodNotImplementedException
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Exception;
trigger_error('The '.__NAMESPACE__.'\NotImplementedException class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\Exception\NotImplementedException class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\Exception\NotImplementedException as BaseNotImplementedException;
/**
* Alias of {@link \Symfony\Component\Intl\Exception\NotImplementedException}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\Exception\NotImplementedException}
* instead.
*/
class NotImplementedException extends BaseNotImplementedException
{
}

View File

@ -1,19 +0,0 @@
Copyright (c) 2004-2015 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,195 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale;
trigger_error('The '.__NAMESPACE__.'\Locale class is deprecated since version 2.7, to be removed in Symfony 3.0. Use the methods provided by the \Symfony\Component\Intl\Intl class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\Intl;
/**
* Helper class for dealing with locale strings.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Locale} and {@link \Symfony\Component\Intl\Intl} instead.
*/
class Locale extends \Locale
{
/**
* Caches the countries in different locales.
*
* @var array
*/
protected static $countries = array();
/**
* Caches the languages in different locales.
*
* @var array
*/
protected static $languages = array();
/**
* Caches the different locales.
*
* @var array
*/
protected static $locales = array();
/**
* Returns the country names for a locale.
*
* @param string $locale The locale to use for the country names
*
* @return array The country names with their codes as keys
*
* @throws \RuntimeException When the resource bundles cannot be loaded
*/
public static function getDisplayCountries($locale)
{
if (!isset(self::$countries[$locale])) {
self::$countries[$locale] = Intl::getRegionBundle()->getCountryNames($locale);
}
return self::$countries[$locale];
}
/**
* Returns all available country codes.
*
* @return array The country codes
*
* @throws \RuntimeException When the resource bundles cannot be loaded
*/
public static function getCountries()
{
return array_keys(self::getDisplayCountries(self::getDefault()));
}
/**
* Returns the language names for a locale.
*
* @param string $locale The locale to use for the language names
*
* @return array The language names with their codes as keys
*
* @throws \RuntimeException When the resource bundles cannot be loaded
*/
public static function getDisplayLanguages($locale)
{
if (!isset(self::$languages[$locale])) {
self::$languages[$locale] = Intl::getLanguageBundle()->getLanguageNames($locale);
}
return self::$languages[$locale];
}
/**
* Returns all available language codes.
*
* @return array The language codes
*
* @throws \RuntimeException When the resource bundles cannot be loaded
*/
public static function getLanguages()
{
return array_keys(self::getDisplayLanguages(self::getDefault()));
}
/**
* Returns the locale names for a locale.
*
* @param string $locale The locale to use for the locale names
*
* @return array The locale names with their codes as keys
*
* @throws \RuntimeException When the resource bundles cannot be loaded
*/
public static function getDisplayLocales($locale)
{
if (!isset(self::$locales[$locale])) {
self::$locales[$locale] = Intl::getLocaleBundle()->getLocaleNames($locale);
}
return self::$locales[$locale];
}
/**
* Returns all available locale codes.
*
* @return array The locale codes
*
* @throws \RuntimeException When the resource bundles cannot be loaded
*/
public static function getLocales()
{
return array_keys(self::getDisplayLocales(self::getDefault()));
}
/**
* Returns the ICU version as defined by the intl extension.
*
* @return string|null The ICU version
*/
public static function getIntlIcuVersion()
{
return Intl::getIcuVersion();
}
/**
* Returns the ICU Data version as defined by the intl extension.
*
* @return string|null The ICU Data version
*/
public static function getIntlIcuDataVersion()
{
return Intl::getIcuDataVersion();
}
/**
* Returns the ICU data version that ships with Symfony. If the environment variable USE_INTL_ICU_DATA_VERSION is
* defined, it will try use the ICU data version as defined by the intl extension, if available.
*
* @return string The ICU data version that ships with Symfony
*/
public static function getIcuDataVersion()
{
return Intl::getIcuDataVersion();
}
/**
* Returns the directory path of the ICU data that ships with Symfony.
*
* @return string The path to the ICU data directory
*/
public static function getIcuDataDirectory()
{
return Intl::getDataDirectory();
}
/**
* Returns the fallback locale for a given locale, if any.
*
* @param string $locale The locale to find the fallback for.
*
* @return string|null The fallback locale, or null if no parent exists
*/
protected static function getFallbackLocale($locale)
{
if (false === $pos = strrpos($locale, '_')) {
return;
}
return substr($locale, 0, $pos);
}
}

View File

@ -1,8 +0,0 @@
Locale Component
================
Locale provides fallback code to handle cases when the ``intl`` extension is
missing.
The Locale component is deprecated since version 2.3 and will be removed in
Symfony 3.0. You should use the more capable Intl component instead.

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\AmPmTransformer class is deprecated since version 2.3 and will be removed in Symfony 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\AmPmTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\AmPmTransformer as BaseAmPmTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\AmPmTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\AmPmTransformer}
* instead.
*/
class AmPmTransformer extends BaseAmPmTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\DayOfWeekTransformer class is deprecated since version 2.3 and will be removed in Symfony 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\DayOfWeekTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\DayOfWeekTransformer as BaseDayOfWeekTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\DayOfWeekTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\DayOfWeekTransformer}
* instead.
*/
class DayOfWeekTransformer extends BaseDayOfWeekTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\DayOfYearTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\DayOfYearTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\DayOfYearTransformer as BaseDayOfYearTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\DayOfYearTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\DayOfYearTransformer}
* instead.
*/
class DayOfYearTransformer extends BaseDayOfYearTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\DayTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\DayTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\DayTransformer as BaseDayTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\DayTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\DayTransformer}
* instead.
*/
class DayTransformer extends BaseDayTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\FullTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\FullTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\FullTransformer as BaseFullTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\FullTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\FullTransformer}
* instead.
*/
class FullTransformer extends BaseFullTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\Hour1200Transformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\Hour1200Transformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\Hour1200Transformer as BaseHour1200Transformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Hour1200Transformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Hour1200Transformer}
* instead.
*/
class Hour1200Transformer extends BaseHour1200Transformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\Hour1201Transformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\Hour1201Transformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\Hour1201Transformer as BaseHour1201Transformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Hour1201Transformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Hour1201Transformer}
* instead.
*/
class Hour1201Transformer extends BaseHour1201Transformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\Hour2400Transformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\Hour2400Transformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\Hour2400Transformer as BaseHour2400Transformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Hour2400Transformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Hour2400Transformer}
* instead.
*/
class Hour2400Transformer extends BaseHour2400Transformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\Hour2401Transformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\Hour2401Transformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\Hour2401Transformer as BaseHour2401Transformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Hour2401Transformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Hour2401Transformer}
* instead.
*/
class Hour2401Transformer extends BaseHour2401Transformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\HourTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\HourTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\HourTransformer as BaseHourTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\HourTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\HourTransformer}
* instead.
*/
abstract class HourTransformer extends BaseHourTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\MinuteTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\MinuteTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\MinuteTransformer as BaseMinuteTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\MinuteTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\MinuteTransformer}
* instead.
*/
class MinuteTransformer extends BaseMinuteTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\MonthTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\MonthTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\MonthTransformer as BaseMonthTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\MonthTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\MonthTransformer}
* instead.
*/
class MonthTransformer extends BaseMonthTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\QuarterTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\QuarterTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\QuarterTransformer as BaseQuarterTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\QuarterTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\QuarterTransformer}
* instead.
*/
class QuarterTransformer extends BaseQuarterTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\SecondTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\SecondTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\SecondTransformer as BaseSecondTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\SecondTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\SecondTransformer}
* instead.
*/
class SecondTransformer extends BaseSecondTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\TimeZoneTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\TimeZoneTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\TimeZoneTransformer as BaseTimeZoneTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\TimeZoneTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\TimeZoneTransformer}
* instead.
*/
class TimeZoneTransformer extends BaseTimeZoneTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\Transformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\Transformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\Transformer as BaseTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Transformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\Transformer}
* instead.
*/
abstract class Transformer extends BaseTransformer
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub\DateFormat;
trigger_error('The '.__NAMESPACE__.'\YearTransformer class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\DateFormat\YearTransformer class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\DateFormat\YearTransformer as BaseYearTransformer;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\DateFormat\YearTransformer}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\DateFormat\YearTransformer}
* instead.
*/
class YearTransformer extends BaseYearTransformer
{
}

View File

@ -1,28 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub;
trigger_error('The '.__NAMESPACE__.'\StubCollator class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\Collator\Collator class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\Collator\Collator;
/**
* Alias of {@link \Symfony\Component\Intl\Collator\Collator}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\Collator\Collator} instead.
*/
class StubCollator extends Collator
{
}

View File

@ -1,28 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub;
trigger_error('The '.__NAMESPACE__.'\StubIntl class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\Globals\IntlGlobals class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\Globals\IntlGlobals;
/**
* Alias of {@link \Symfony\Component\Intl\Globals\IntlGlobals}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\Globals\IntlGlobals} instead.
*/
abstract class StubIntl extends IntlGlobals
{
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub;
trigger_error('The '.__NAMESPACE__.'\StubIntlDateFormatter class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\DateFormatter\IntlDateFormatter class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\DateFormatter\IntlDateFormatter;
/**
* Alias of {@link \Symfony\Component\Intl\DateFormatter\IntlDateFormatter}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\DateFormatter\IntlDateFormatter}
* instead.
*/
class StubIntlDateFormatter extends IntlDateFormatter
{
}

View File

@ -1,110 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub;
trigger_error('The '.__NAMESPACE__.'\StubLocale class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\Locale\Locale and Symfony\Component\Intl\Intl classes instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\Locale\Locale;
/**
* Alias of {@link \Symfony\Component\Intl\Locale\Locale}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\Locale\Locale} and
* {@link \Symfony\Component\Intl\Intl} instead.
*/
class StubLocale extends Locale
{
/**
* Caches the currencies.
*
* @var array
*/
protected static $currencies;
/**
* Caches the currencies names.
*
* @var array
*/
protected static $currenciesNames;
/**
* Returns the currencies data.
*
* @param string $locale
*
* @return array The currencies data
*/
public static function getCurrenciesData($locale)
{
if (null === self::$currencies) {
self::prepareCurrencies($locale);
}
return self::$currencies;
}
/**
* Returns the currencies names for a locale.
*
* @param string $locale The locale to use for the currencies names
*
* @return array The currencies names with their codes as keys
*
* @throws \InvalidArgumentException When the locale is different than 'en'
*/
public static function getDisplayCurrencies($locale)
{
if (null === self::$currenciesNames) {
self::prepareCurrencies($locale);
}
return self::$currenciesNames;
}
/**
* Returns all available currencies codes.
*
* @return array The currencies codes
*/
public static function getCurrencies()
{
return array_keys(self::getCurrenciesData(self::getDefault()));
}
public static function getDataDirectory()
{
return Intl::getDataDirectory();
}
private static function prepareCurrencies($locale)
{
self::$currencies = array();
self::$currenciesNames = array();
$bundle = Intl::getCurrencyBundle();
foreach ($bundle->getCurrencyNames($locale) as $currency => $name) {
self::$currencies[$currency] = array(
'name' => $name,
'symbol' => $bundle->getCurrencySymbol($currency, $locale),
'fractionDigits' => $bundle->getFractionDigits($currency),
'roundingIncrement' => $bundle->getRoundingIncrement($currency),
);
self::$currenciesNames[$currency] = $name;
}
}
}

View File

@ -1,29 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Stub;
trigger_error('The '.__NAMESPACE__.'\StubNumberFormatter class is deprecated since version 2.3 and will be removed in 3.0. Use the Symfony\Component\Intl\NumberFormatter\NumberFormatter class instead.', E_USER_DEPRECATED);
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
/**
* Alias of {@link \Symfony\Component\Intl\NumberFormatter\NumberFormatter}.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 2.3, to be removed in 3.0.
* Use {@link \Symfony\Component\Intl\NumberFormatter\NumberFormatter}
* instead.
*/
class StubNumberFormatter extends NumberFormatter
{
}

View File

@ -1,79 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Tests;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Locale\Locale;
/**
* Test case for the {@link Locale} class.
*
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class LocaleTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
// Locale extends \Locale, so intl must be present
IntlTestHelper::requireIntl($this);
}
public function testGetDisplayCountries()
{
$countries = Locale::getDisplayCountries('en');
$this->assertEquals('Brazil', $countries['BR']);
}
public function testGetDisplayCountriesForSwitzerland()
{
$countries = Locale::getDisplayCountries('de_CH');
$this->assertEquals('Schweiz', $countries['CH']);
}
public function testGetCountries()
{
$countries = Locale::getCountries();
$this->assertContains('BR', $countries);
}
public function testGetCountriesForSwitzerland()
{
$countries = Locale::getCountries();
$this->assertContains('CH', $countries);
}
public function testGetDisplayLanguages()
{
$languages = Locale::getDisplayLanguages('en');
$this->assertEquals('Brazilian Portuguese', $languages['pt_BR']);
}
public function testGetLanguages()
{
$languages = Locale::getLanguages();
$this->assertContains('pt_BR', $languages);
}
public function testGetDisplayLocales()
{
$locales = Locale::getDisplayLocales('en');
$this->assertEquals('Portuguese', $locales['pt']);
}
public function testGetLocales()
{
$locales = Locale::getLocales();
$this->assertContains('pt', $locales);
}
}

View File

@ -1,54 +0,0 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Locale\Tests\Stub;
use Symfony\Component\Intl\Util\IntlTestHelper;
use Symfony\Component\Locale\Stub\StubLocale;
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*/
class StubLocaleTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
// Locale extends \Locale, so intl must be present
IntlTestHelper::requireIntl($this);
}
public function testGetCurrenciesData()
{
$currencies = StubLocale::getCurrenciesData('en');
$this->assertEquals('R$', $currencies['BRL']['symbol']);
$this->assertEquals('Brazilian Real', $currencies['BRL']['name']);
$this->assertEquals(2, $currencies['BRL']['fractionDigits']);
$this->assertEquals(0, $currencies['BRL']['roundingIncrement']);
}
public function testGetDisplayCurrencies()
{
$currencies = StubLocale::getDisplayCurrencies('en');
$this->assertEquals('Brazilian Real', $currencies['BRL']);
// Checking that the cache is being used
$currencies = StubLocale::getDisplayCurrencies('en');
$this->assertEquals('Argentine Peso', $currencies['ARS']);
}
public function testGetCurrencies()
{
$currencies = StubLocale::getCurrencies();
$this->assertTrue(in_array('BRL', $currencies));
}
}

View File

@ -1,35 +0,0 @@
{
"name": "symfony/locale",
"type": "library",
"description": "Symfony Locale Component",
"keywords": [],
"homepage": "http://symfony.com",
"license": "MIT",
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
}
],
"require": {
"php": ">=5.5.9",
"symfony/intl": "~2.7|~3.0"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7|~3.0"
},
"autoload": {
"psr-0": { "Symfony\\Component\\Locale\\": "" }
},
"target-dir": "Symfony/Component/Locale",
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
}
}

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php"
>
<php>
<ini name="error_reporting" value="-1" />
</php>
<testsuites>
<testsuite name="Symfony Locale Component Test Suite">
<directory>./Tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./Resources</directory>
<directory>./Tests</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>