public getLocalizedLiteralsForLocale ( |
||
$locale | ||
return | array | An array with localized literals |
public function getLocalizedLiteralsForLocale(Locale $locale)
{
if (isset($this->localizedLiterals[(string) $locale])) {
return $this->localizedLiterals[(string) $locale];
}
$model = $this->cldrRepository->getModelForLocale($locale);
$localizedLiterals['months'] = $this->parseLocalizedLiterals($model, 'month');
$localizedLiterals['days'] = $this->parseLocalizedLiterals($model, 'day');
$localizedLiterals['quarters'] = $this->parseLocalizedLiterals($model, 'quarter');
$localizedLiterals['dayPeriods'] = $this->parseLocalizedLiterals($model, 'dayPeriod');
$localizedLiterals['eras'] = $this->parseLocalizedEras($model);
return $this->localizedLiterals[(string) $locale] = $localizedLiterals;
}
/** * Formats dateTime with format string for date and time defined in CLDR for * particular locale. * * First date and time are formatted separately, and then dateTime format * from CLDR is used to place date and time in correct order. * * @param \DateTimeInterface $dateTime PHP object representing particular point in time * @param Locale $locale * @param string $formatLength One of DatesReader FORMAT_LENGTH constants * @return string Formatted date and time * @api */ public function formatDateTime(\DateTimeInterface $dateTime, Locale $locale, $formatLength = DatesReader::FORMAT_LENGTH_DEFAULT) { DatesReader::validateFormatLength($formatLength); return $this->doFormattingWithParsedFormat($dateTime, $this->datesReader->parseFormatFromCldr($locale, DatesReader::FORMAT_TYPE_DATETIME, $formatLength), $this->datesReader->getLocalizedLiteralsForLocale($locale)); }