monthYearContainer.appendChild(_dateMonth);
let months = "";
- const monthNames = Language.get("__monthsShort");
+ const monthNames = (Language.get("__monthsShort") as any) as string[];
for (let i = 0; i < 12; i++) {
months += `<option value="${i}">${monthNames[i]}</option>`;
}
item.className = "weekdays";
_dateGrid.appendChild(item);
- const weekdays = Language.get("__daysShort");
+ const weekdays = (Language.get("__daysShort") as any) as string[];
for (let i = 0; i < 7; i++) {
let day = i + _firstDayOfWeek;
if (day > 6) {
// get day of week
const dateObj = DateUtil.getTimezoneDate(elTimestamp * 1000, parseInt(elOffset, 10) * 1000);
const dow = dateObj.getDay();
- const day = Language.get("__days")[dow];
+ const day = ((Language.get("__days") as any) as string[])[dow];
element.textContent = Language.get("wcf.date.relative.pastDays", { days: days, day: day, time: elTime });
}
break;
case "l":
// `Monday` through `Sunday` (localized)
- char = Language.get("__days")[date.getDay()];
+ char = ((Language.get("__days") as any) as string[])[date.getDay()];
break;
case "D":
// `Mon` through `Sun` (localized)
- char = Language.get("__daysShort")[date.getDay()];
+ char = ((Language.get("__daysShort") as any) as string[])[date.getDay()];
break;
case "S":
// ignore english ordinal suffix
break;
case "F":
// `January` through `December` (localized)
- char = Language.get("__months")[date.getMonth()];
+ char = ((Language.get("__months") as any) as string[])[date.getMonth()];
break;
case "M":
// `Jan` through `Dec` (localized)
- char = Language.get("__monthsShort")[date.getMonth()];
+ char = ((Language.get("__monthsShort") as any) as string[])[date.getMonth()];
break;
// year
* Adds a single language item to the store.
*/
export function add(key: string, value: string): void {
- addToStore(key, compile(value));
+ if (typeof value === "string") {
+ addToStore(key, compile(value));
+ } else {
+ // Historically a few items that are added to the language store do not represent actual phrases, but
+ // instead contain a collection (i.e. Array) of items. Most notably these are entries related to date
+ // processing, containg lists of localized month / weekday names.
+ //
+ // Despite this method technically only taking `string`s as the `value` we need to correctly handle
+ // them which we do by simply storing a function that returns the value as-is.
+ addToStore(key, function () {
+ return value;
+ });
+ }
}
/**
* Adds a single language item to the store.
*/
function add(key, value) {
- Store_1.add(key, compile(value));
+ if (typeof value === "string") {
+ Store_1.add(key, compile(value));
+ }
+ else {
+ // Historically a few items that are added to the language store do not represent actual phrases, but
+ // instead contain a collection (i.e. Array) of items. Most notably these are entries related to date
+ // processing, containg lists of localized month / weekday names.
+ //
+ // Despite this method technically only taking `string`s as the `value` we need to correctly handle
+ // them which we do by simply storing a function that returns the value as-is.
+ Store_1.add(key, function () {
+ return value;
+ });
+ }
}
exports.add = add;
/**