Neos\Flow\I18n\Cldr\Reader\NumbersReader::getLocalizedSymbolsForLocale PHP Метод

getLocalizedSymbolsForLocale() публичный Метод

Symbols are elements defined in tag symbols from CLDR. They define localized versions of various number-related elements, like decimal separator, group separator or minus sign. Symbols arrays for every requested locale are cached.
public getLocalizedSymbolsForLocale ( Locale $locale ) : array
$locale Neos\Flow\I18n\Locale
Результат array Symbols array
    public function getLocalizedSymbolsForLocale(Locale $locale)
    {
        if (isset($this->localizedSymbols[(string) $locale])) {
            return $this->localizedSymbols[(string) $locale];
        }
        $model = $this->cldrRepository->getModelForLocale($locale);
        return $this->localizedSymbols[(string) $locale] = $model->getRawArray('numbers/symbols');
    }

Usage Example

 /**
  * Formats number with format string for currency defined in CLDR for
  * particular locale.
  *
  * Currency symbol provided will be inserted into formatted number string.
  *
  * Note: currently length is not used in currencyFormats from CLDR.
  * But it's defined in the specification, so we support it here.
  *
  * @param mixed $number Float or int, can be negative, can be NaN or infinite
  * @param Locale $locale
  * @param string $currency Currency symbol (or name)
  * @param string $formatLength One of NumbersReader FORMAT_LENGTH constants
  * @return string Formatted number. Will return string-casted version of $number if there is no pattern for given $locale / $formatLength
  * @api
  */
 public function formatCurrencyNumber($number, Locale $locale, $currency, $formatLength = NumbersReader::FORMAT_LENGTH_DEFAULT)
 {
     NumbersReader::validateFormatLength($formatLength);
     return $this->doFormattingWithParsedFormat($number, $this->numbersReader->parseFormatFromCldr($locale, NumbersReader::FORMAT_TYPE_CURRENCY, $formatLength), $this->numbersReader->getLocalizedSymbolsForLocale($locale), $currency);
 }
All Usage Examples Of Neos\Flow\I18n\Cldr\Reader\NumbersReader::getLocalizedSymbolsForLocale