buildInvoiceLabels (invoice-pdf/invoiceLabels.ts)

invoify · app/components/templates/invoice-pdf/invoiceLabels.ts · typescript · MIT
payments

Utility to build localized invoice labels with English fallback for PDF generation

// Source: https://github.com/al1abb/invoify | License: MIT | Copyright 2023 Ali Abbasov
// Provided via justclaw.it.com; keep this notice with the code.
import enMessages from "@/i18n/locales/en.json";

/**
 * The set of strings the invoice document itself renders.
 *
 * These are passed to the templates as a plain prop rather than read from
 * next-intl's hooks, because the same components are rendered two different
 * ways: inside the client tree for the live preview, and through
 * `renderToStaticMarkup` in a route handler for the PDF.
 *
 * A React context was tried first and does not work here — anything exported
 * from a "use client" module becomes a client-reference proxy when imported by
 * a route handler, so neither the provider nor a helper could be used
 * server-side. A prop

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key