feat: Engelse en uitgebreide event-namen in derivePageCaption (xmas, hween, easter, val_, newyear, summer, carnival, anniversary, hb_, holiday, etc.)
This commit is contained in:
1 parent
2c2e9749ca
commit
91254bcec2
1 file changed
+57
-12
@@ -31,27 +31,72 @@ function escSqlLiteral(value: string): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Derive a human-readable Dutch page caption from a furniture classname that
|
* Derive a human-readable English page caption from a furniture classname that
|
||||||
* follows an event+year pattern (e.g. `xmas2025`, `hween2024`, `val_2025`).
|
* follows an event+year pattern (e.g. `xmas2025`, `hween2024`, `val_2025`).
|
||||||
* Falls back to `fallback` when no pattern matches.
|
* Covers the full range of seasonal/holiday prefixes that have appeared in
|
||||||
|
* Habbo's history. Falls back to `fallback` when no pattern matches.
|
||||||
*/
|
*/
|
||||||
function derivePageCaption(classname: string, fallback: string): string {
|
function derivePageCaption(classname: string, fallback: string): string {
|
||||||
const m = classname.match(
|
const m = classname.match(
|
||||||
/^(xmas|hween|easter|val_|valentine|hw_|newyear|summer|carnival)(\d{4})/i,
|
/^(xmas|hween|halloween|easter|val_|valentine|hw_|newyear|nye|summer|sum_|carnival|carnival_|christmas|xmas_|easter_|valentines|anniversary|anniv_|anniv|hb_|_hb|hb|habbohome|hh_|easter_bunny|easterbunny|easter_b|spring|summer_|summer2|summersale|fall|autumn|autumn_|fall_|winter|winter_|xmas2|christmas2|xmas20|holiday|holidays|holiday_|halloween2|hween2|hween_)(_?)(\d{4})/i,
|
||||||
);
|
);
|
||||||
if (!m) return fallback;
|
if (!m) return fallback;
|
||||||
const event = m[1].toLowerCase();
|
const event = m[1].toLowerCase();
|
||||||
const year = m[2];
|
const year = m[3];
|
||||||
const eventNames: Record<string, string> = {
|
const eventNames: Record<string, string> = {
|
||||||
xmas: "Kerst",
|
xmas: "Christmas",
|
||||||
|
xmas_: "Christmas",
|
||||||
|
xmas2: "Christmas",
|
||||||
|
xmas20: "Christmas",
|
||||||
|
christmas: "Christmas",
|
||||||
|
christmas_: "Christmas",
|
||||||
|
christmas2: "Christmas",
|
||||||
hween: "Halloween",
|
hween: "Halloween",
|
||||||
easter: "Pasen",
|
hween_: "Halloween",
|
||||||
val_: "Valentijn",
|
hween2: "Halloween",
|
||||||
valentine: "Valentijn",
|
halloween: "Halloween",
|
||||||
|
halloween_: "Halloween",
|
||||||
|
halloween2: "Halloween",
|
||||||
hw_: "Halloween",
|
hw_: "Halloween",
|
||||||
newyear: "Nieuwjaar",
|
easter: "Easter",
|
||||||
summer: "Zomer",
|
easter_: "Easter",
|
||||||
carnival: "Carnaval",
|
easter_bunny: "Easter",
|
||||||
|
easterbunny: "Easter",
|
||||||
|
easter_b: "Easter",
|
||||||
|
val_: "Valentine's Day",
|
||||||
|
valentine: "Valentine's Day",
|
||||||
|
valentine_: "Valentine's Day",
|
||||||
|
valentines: "Valentine's Day",
|
||||||
|
valentines_: "Valentine's Day",
|
||||||
|
newyear: "New Year",
|
||||||
|
nye: "New Year",
|
||||||
|
newyear_: "New Year",
|
||||||
|
summer: "Summer",
|
||||||
|
summer_: "Summer",
|
||||||
|
summer2: "Summer",
|
||||||
|
summersale: "Summer Sale",
|
||||||
|
fall: "Fall",
|
||||||
|
fall_: "Fall",
|
||||||
|
autumn: "Autumn",
|
||||||
|
autumn_: "Autumn",
|
||||||
|
winter: "Winter",
|
||||||
|
winter_: "Winter",
|
||||||
|
carnival: "Carnival",
|
||||||
|
carnival_: "Carnival",
|
||||||
|
anniversary: "Anniversary",
|
||||||
|
anniv: "Anniversary",
|
||||||
|
anniv_: "Anniversary",
|
||||||
|
anniversary_: "Anniversary",
|
||||||
|
hb: "Habbo Birthday",
|
||||||
|
_hb: "Habbo Birthday",
|
||||||
|
hb_: "Habbo Birthday",
|
||||||
|
habbohome: "HabboHome",
|
||||||
|
hh_: "Habbo Birthday",
|
||||||
|
spring: "Spring",
|
||||||
|
holiday: "Holiday",
|
||||||
|
holiday_: "Holiday",
|
||||||
|
holidays: "Holiday",
|
||||||
|
holidays_: "Holiday",
|
||||||
};
|
};
|
||||||
return `${eventNames[event] ?? event} ${year}`;
|
return `${eventNames[event] ?? event} ${year}`;
|
||||||
}
|
}
|
||||||
@@ -64,7 +109,7 @@ function derivePageCaption(classname: string, fallback: string): string {
|
|||||||
*
|
*
|
||||||
* When `organizeSql` is true, the output also contains `catalog_pages` INSERT
|
* When `organizeSql` is true, the output also contains `catalog_pages` INSERT
|
||||||
* statements that organise items into sub-pages under "Imported Furniture",
|
* statements that organise items into sub-pages under "Imported Furniture",
|
||||||
* using derived Dutch captions by event+year (e.g. "Kerst 2025").
|
* using derived English captions by event+year (e.g. "Christmas 2025").
|
||||||
*/
|
*/
|
||||||
export async function generateCatalogSql(
|
export async function generateCatalogSql(
|
||||||
entries: MissingCatalogEntry[],
|
entries: MissingCatalogEntry[],
|
||||||
|
|||||||
Reference in new issue
Block a user