@@ -107,9 +107,7 @@ protected function _toHtml()
107
107
]
108
108
);
109
109
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 );
113
111
114
112
// get "am" & "pm" words
115
113
$ this ->assign ('am ' , $ this ->encoder ->encode ($ localeData ['calendar ' ]['gregorian ' ]['AmPmMarkers ' ]['0 ' ]));
@@ -189,4 +187,25 @@ public function getYearRange()
189
187
return (new \DateTime ())->modify ('- 100 years ' )->format ('Y ' )
190
188
. ': ' . (new \DateTime ())->modify ('+ 100 years ' )->format ('Y ' );
191
189
}
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
+ }
192
211
}
0 commit comments