File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
lib/internal/Magento/Framework/View Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -109,10 +109,7 @@ protected function _toHtml()
109
109
);
110
110
111
111
$ this ->assignFieldsValues ($ localeData );
112
-
113
- // get "am" & "pm" words
114
- $ this ->assign ('am ' , $ this ->encoder ->encode ($ localeData ['calendar ' ]['gregorian ' ]['AmPmMarkers ' ]['0 ' ]));
115
- $ this ->assign ('pm ' , $ this ->encoder ->encode ($ localeData ['calendar ' ]['gregorian ' ]['AmPmMarkers ' ]['1 ' ]));
112
+ $ this ->assignAmPmWords ($ localeData );
116
113
117
114
// get first day of week and weekend days
118
115
$ this ->assign (
@@ -209,4 +206,23 @@ private function assignFieldsValues(\ResourceBundle $localeData): void
209
206
$ this ->assign ('week ' , $ this ->encoder ->encode ($ localeData ['fields ' ]['week ' ]['dn ' ]));
210
207
}
211
208
}
209
+
210
+ /**
211
+ * Assign "am" & "pm" words from the ICU data
212
+ *
213
+ * @param \ResourceBundle $localeData
214
+ */
215
+ private function assignAmPmWords (\ResourceBundle $ localeData ): void
216
+ {
217
+ // AmPmMarkers and AmPmMarkersAbbr aren't guaranteed to exist, so fallback to null if neither exist
218
+ $ amWord = $ localeData ['calendar ' ]['gregorian ' ]['AmPmMarkers ' ][0 ] ??
219
+ $ localeData ['calendar ' ]['gregorian ' ]['AmPmMarkersAbbr ' ][0 ] ??
220
+ null ;
221
+ $ pmWord = $ localeData ['calendar ' ]['gregorian ' ]['AmPmMarkers ' ][1 ] ??
222
+ $ localeData ['calendar ' ]['gregorian ' ]['AmPmMarkersAbbr ' ][1 ] ??
223
+ null ;
224
+
225
+ $ this ->assign ('am ' , $ this ->encoder ->encode ($ amWord ));
226
+ $ this ->assign ('pm ' , $ this ->encoder ->encode ($ pmWord ));
227
+ }
212
228
}
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ public function localesDataProvider()
48
48
['en_US ' ],
49
49
['ja_JP ' ],
50
50
['ko_KR ' ],
51
+ ['lv_LV ' ],
52
+ ['sv_SE ' ],
53
+ ['de_AT ' ],
51
54
];
52
55
}
53
56
You can’t perform that action at this time.
0 commit comments