Files
vmall/apps/mall/locales-extra.ts
T
Chengdong Zhang 21e99bb52b feat(mall): classic B2B2C PC storefront with fixed mock API layer
- Mock adapter implementing @vmall/shared ApiClient (localStorage-persisted
  cart/orders/invoices), runtime switch via mockApi flag (default on)
- Fixed bilingual mock catalog: 3-level categories, 24 products w/ SKUs,
  stores, brands, banners, floors, seckill/collective/integral, comments,
  coupons, addresses, seeded orders/shipments/invoices
- B2B2C mall shell: top bar, logo/search/cart header, dark nav + category
  mega-menu, value-prop footer, back-to-top; 1200px grid, #ca151e theme
- UI primitives replacing element-plus: carousel, pagination, breadcrumb,
  qty stepper, rating stars, modal, tabs, step bar, product card
- Pages: home floors, search (filters/sort/paging), goods detail (SKU
  picker, store rail, review tabs), cart -> checkout -> pay -> success,
  auth pages, user center (dashboard/orders/addresses/favorites/coupons/
  invoices), stores, seckill, collective, integral
- i18n split into per-domain locale modules (en+zh)
- OpenSpec change mall-pc-storefront-replica archived; all specs green
2026-09-17 19:13:29 +08:00

54 lines
1.5 KiB
TypeScript

// App-local message extensions, deep-merged over @vmall/shared locales.
// Each domain module owns its own namespace; register new domains below.
// (Never edit the shared locale files from an app agent.)
import shell from "./locales/shell";
import home from "./locales/home";
import search from "./locales/search";
import product from "./locales/product";
import cart from "./locales/cart";
import checkout from "./locales/checkout";
import auth from "./locales/auth";
import user from "./locales/user";
import stores from "./locales/stores";
import marketing from "./locales/marketing";
type Tree = Record<string, unknown>;
function deepMerge<T extends Tree>(base: T, extra: Tree): T {
const out: Tree = { ...base };
for (const [k, v] of Object.entries(extra)) {
const b = out[k];
out[k] = b && v && typeof b === "object" && typeof v === "object"
? deepMerge(b as Tree, v as Tree)
: v;
}
return out as T;
}
// Keys referenced by retained shared components (PriceText) and generic handlers.
const legacyEn: Tree = {
mall: {
notAvailable: "—",
loadFailed: "Unable to load data",
},
};
const legacyZh: Tree = {
mall: {
notAvailable: "—",
loadFailed: "加载失败",
},
};
const domains = [shell, home, search, product, cart, checkout, auth, user, stores, marketing];
export const enExtra: Tree = domains.reduce<Tree>(
(acc, m) => deepMerge(acc, m.en as Tree),
legacyEn,
);
export const zhExtra: Tree = domains.reduce<Tree>(
(acc, m) => deepMerge(acc, m.zh as Tree),
legacyZh,
);