@@ -107,20 +107,7 @@ protected function _toHtml()
107107 ]
108108 );
109109
110- /**
111- * Get "today" and "week" words
112- *
113- * Fields value in the current position have been added to ICU Data tables,
114- * starting with ICU library version 51.1.
115- * Due to fact that we do not use these variables in templates, we do not initialize them for older versions
116- *
117- * @see https://github.com/unicode-org/icu/blob/release-50-2/icu4c/source/data/locales/en.txt
118- * @see https://github.com/unicode-org/icu/blob/release-51-2/icu4c/source/data/locales/en.txt
119- */
120- if ($ localeData ->get ('fields ' )) {
121- $ this ->assign ('today ' , $ this ->encoder ->encode ($ localeData ['fields ' ]['day ' ]['relative ' ]['0 ' ]));
122- $ this ->assign ('week ' , $ this ->encoder ->encode ($ localeData ['fields ' ]['week ' ]['dn ' ]));
123- }
110+ $ this ->assignFieldsValues ($ localeData );
124111
125112 // get "am" & "pm" words
126113 $ this ->assign ('am ' , $ this ->encoder ->encode ($ localeData ['calendar ' ]['gregorian ' ]['AmPmMarkers ' ]['0 ' ]));
@@ -200,4 +187,25 @@ public function getYearRange()
200187 return (new \DateTime ())->modify ('- 100 years ' )->format ('Y ' )
201188 . ': ' . (new \DateTime ())->modify ('+ 100 years ' )->format ('Y ' );
202189 }
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+ }
203211}
0 commit comments