[Translation] moved most protected methods and properties to private
This commit is contained in:
parent
94c445957c
commit
75b29ffdfe
@ -18,7 +18,7 @@ namespace Symfony\Component\Translation;
|
|||||||
*/
|
*/
|
||||||
class IdentityTranslator implements TranslatorInterface
|
class IdentityTranslator implements TranslatorInterface
|
||||||
{
|
{
|
||||||
protected $selector;
|
private $selector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -90,7 +90,7 @@ class Interval
|
|||||||
EOF;
|
EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static protected function convertNumber($number)
|
static private function convertNumber($number)
|
||||||
{
|
{
|
||||||
if ('-Inf' === $number) {
|
if ('-Inf' === $number) {
|
||||||
return log(0);
|
return log(0);
|
||||||
|
@ -46,7 +46,7 @@ class ArrayLoader implements LoaderInterface
|
|||||||
* @param array $subnode current subnode being parsed, used internally for recursive calls
|
* @param array $subnode current subnode being parsed, used internally for recursive calls
|
||||||
* @param string $path current path being parsed, used internally for recursive calls
|
* @param string $path current path being parsed, used internally for recursive calls
|
||||||
*/
|
*/
|
||||||
protected function flatten(array &$messages, array $subnode = null, $path = null)
|
private function flatten(array &$messages, array $subnode = null, $path = null)
|
||||||
{
|
{
|
||||||
if (null === $subnode) {
|
if (null === $subnode) {
|
||||||
$subnode =& $messages;
|
$subnode =& $messages;
|
||||||
|
@ -44,7 +44,7 @@ class XliffFileLoader implements LoaderInterface
|
|||||||
* @param string $file
|
* @param string $file
|
||||||
* @return SimpleXMLElement
|
* @return SimpleXMLElement
|
||||||
*/
|
*/
|
||||||
protected function parseFile($file)
|
private function parseFile($file)
|
||||||
{
|
{
|
||||||
$dom = new \DOMDocument();
|
$dom = new \DOMDocument();
|
||||||
$current = libxml_use_internal_errors(true);
|
$current = libxml_use_internal_errors(true);
|
||||||
@ -74,7 +74,7 @@ class XliffFileLoader implements LoaderInterface
|
|||||||
*
|
*
|
||||||
* @return array An array of errors
|
* @return array An array of errors
|
||||||
*/
|
*/
|
||||||
protected function getXmlErrors()
|
private function getXmlErrors()
|
||||||
{
|
{
|
||||||
$errors = array();
|
$errors = array();
|
||||||
foreach (libxml_get_errors() as $error) {
|
foreach (libxml_get_errors() as $error) {
|
||||||
|
@ -20,9 +20,9 @@ use Symfony\Component\Config\Resource\ResourceInterface;
|
|||||||
*/
|
*/
|
||||||
class MessageCatalogue implements MessageCatalogueInterface
|
class MessageCatalogue implements MessageCatalogueInterface
|
||||||
{
|
{
|
||||||
protected $messages = array();
|
private $messages = array();
|
||||||
protected $locale;
|
private $locale;
|
||||||
protected $resources;
|
private $resources;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -19,7 +19,7 @@ namespace Symfony\Component\Translation;
|
|||||||
class PluralizationRules
|
class PluralizationRules
|
||||||
{
|
{
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
static protected $rules = array();
|
static private $rules = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the plural position to use for the given locale and number.
|
* Returns the plural position to use for the given locale and number.
|
||||||
|
@ -20,12 +20,12 @@ use Symfony\Component\Translation\Loader\LoaderInterface;
|
|||||||
*/
|
*/
|
||||||
class Translator implements TranslatorInterface
|
class Translator implements TranslatorInterface
|
||||||
{
|
{
|
||||||
protected $catalogues;
|
private $catalogues;
|
||||||
protected $locale;
|
private $locale;
|
||||||
protected $fallbackLocale;
|
private $fallbackLocale;
|
||||||
protected $loaders;
|
private $loaders;
|
||||||
protected $resources;
|
private $resources;
|
||||||
protected $selector;
|
private $selector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -131,12 +131,11 @@ class Translator implements TranslatorInterface
|
|||||||
return strtr($this->selector->choose($this->catalogues[$locale]->get($id, $domain), (int) $number, $locale), $parameters);
|
return strtr($this->selector->choose($this->catalogues[$locale]->get($id, $domain), (int) $number, $locale), $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function loadCatalogue($locale)
|
private function loadCatalogue($locale)
|
||||||
{
|
{
|
||||||
$this->catalogues[$locale] = new MessageCatalogue($locale);
|
$this->catalogues[$locale] = new MessageCatalogue($locale);
|
||||||
|
|
||||||
if (isset($this->resources[$locale])) {
|
if (isset($this->resources[$locale])) {
|
||||||
|
|
||||||
foreach ($this->resources[$locale] as $resource) {
|
foreach ($this->resources[$locale] as $resource) {
|
||||||
if (!isset($this->loaders[$resource[0]])) {
|
if (!isset($this->loaders[$resource[0]])) {
|
||||||
throw new \RuntimeException(sprintf('The "%s" translation loader is not registered.', $resource[0]));
|
throw new \RuntimeException(sprintf('The "%s" translation loader is not registered.', $resource[0]));
|
||||||
@ -148,7 +147,7 @@ class Translator implements TranslatorInterface
|
|||||||
$this->optimizeCatalogue($locale);
|
$this->optimizeCatalogue($locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function optimizeCatalogue($locale)
|
private function optimizeCatalogue($locale)
|
||||||
{
|
{
|
||||||
if (strlen($locale) > 3) {
|
if (strlen($locale) > 3) {
|
||||||
$fallback = substr($locale, 0, -strlen(strrchr($locale, '_')));
|
$fallback = substr($locale, 0, -strlen(strrchr($locale, '_')));
|
||||||
|
Reference in New Issue
Block a user