Skip to content

Commit c4ca054

Browse files
committed
Merge remote-tracking branch 'origin/MC-35649' into 2.4.0-develop-pr65
2 parents d7156cc + 3d0cbfa commit c4ca054

File tree

1 file changed

+22
-3
lines changed
  • lib/internal/Magento/Framework/View/Element/Html

1 file changed

+22
-3
lines changed

lib/internal/Magento/Framework/View/Element/Html/Calendar.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ protected function _toHtml()
107107
]
108108
);
109109

110-
// get "today" and "week" words
111-
$this->assign('today', $this->encoder->encode($localeData['fields']['day']['relative']['0']));
112-
$this->assign('week', $this->encoder->encode($localeData['fields']['week']['dn']));
110+
$this->assignFieldsValues($localeData);
113111

114112
// get "am" & "pm" words
115113
$this->assign('am', $this->encoder->encode($localeData['calendar']['gregorian']['AmPmMarkers']['0']));
@@ -189,4 +187,25 @@ public function getYearRange()
189187
return (new \DateTime())->modify('- 100 years')->format('Y')
190188
. ':' . (new \DateTime())->modify('+ 100 years')->format('Y');
191189
}
190+
191+
/**
192+
* Assign "fields" values from the ICU data
193+
*
194+
* @param \ResourceBundle $localeData
195+
*/
196+
private function assignFieldsValues(\ResourceBundle $localeData): void
197+
{
198+
/**
199+
* Fields value in the current position has been added to ICU Data tables
200+
* starting with ICU library version 51.1.
201+
* Due to fact that we do not use these variables in templates, we do not initialize them for older versions
202+
*
203+
* @see https://github.com/unicode-org/icu/blob/release-50-2/icu4c/source/data/locales/en.txt
204+
* @see https://github.com/unicode-org/icu/blob/release-51-2/icu4c/source/data/locales/en.txt
205+
*/
206+
if ($localeData->get('fields')) {
207+
$this->assign('today', $this->encoder->encode($localeData['fields']['day']['relative']['0']));
208+
$this->assign('week', $this->encoder->encode($localeData['fields']['week']['dn']));
209+
}
210+
}
192211
}

0 commit comments

Comments
 (0)