From ceaf783d0b5a72d2f5a25c4471e667d2087dc648 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Wed, 26 Feb 2020 13:20:41 +0000 Subject: [PATCH] Issue #3104071 by jungle, knyshuk.vova: DrupalDateTime::$formatTranslationCache should be an array --- .../Drupal/Core/Datetime/DrupalDateTime.php | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php index 9f9edc47398a..49aff3f8fa21 100644 --- a/core/lib/Drupal/Core/Datetime/DrupalDateTime.php +++ b/core/lib/Drupal/Core/Datetime/DrupalDateTime.php @@ -23,9 +23,34 @@ class DrupalDateTime extends DateTimePlus { use StringTranslationTrait; /** - * Format string translation cache. + * Formatted strings translation cache. * - * @var string + * Translation cache represents an instance storage for formatted date + * strings. It contains a multidimensional array where: + * - first level keys - are drupal language codes; + * - second level keys - are each symbols of given format string (like 'F'); + * - third level keys - are original matched strings related to the symbol; + * - values - are translated or not-translated original strings (depends on + * if a particular symbol represents translatable value according to PHP's + * date() format character). + * + * For example: + * @code + * [ + * 'en' => [ + * 'F' => [ + * 'November' => t('November'), + * 'December' => t('December'), + * ], + * 'd' => [ + * '10' => '10', + * '31' => '31', + * ], + * ], + * ] + * @endcode + * + * @var array */ protected $formatTranslationCache;