fix: resolve next-intl translation parameter error in print footer
Fix IntlError: FORMATTING_ERROR for print footer translation:
- Pass date parameter correctly to t("print-footer") in server component
- Remove manual string replacement in client component
- Use proper next-intl parameter syntax: t("key", { param: value })
Error was caused by next-intl expecting translation parameters
to be passed at the translation function call level, not through
manual string replacement afterward.
Print preview now loads without FORMATTING_ERROR and displays
localized footer text correctly in both English and Croatian.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,7 @@ export default async function PrintPage({ params }: PrintPageProps) {
|
|||||||
barcodesFound: t("barcodes-found"),
|
barcodesFound: t("barcodes-found"),
|
||||||
barcodeSingular: t("barcode-singular"),
|
barcodeSingular: t("barcode-singular"),
|
||||||
printButton: t("print-button"),
|
printButton: t("print-button"),
|
||||||
printFooter: t("print-footer"),
|
printFooter: t("print-footer", { date: new Date().toLocaleDateString() }),
|
||||||
tableHeaderIndex: t("table-header-index"),
|
tableHeaderIndex: t("table-header-index"),
|
||||||
tableHeaderBillInfo: t("table-header-bill-info"),
|
tableHeaderBillInfo: t("table-header-bill-info"),
|
||||||
tableHeaderBarcode: t("table-header-barcode")
|
tableHeaderBarcode: t("table-header-barcode")
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ export const PrintPreview: React.FC<PrintPreviewProps> = ({ data, year, month, t
|
|||||||
|
|
||||||
{/* Print footer - only visible when printing */}
|
{/* Print footer - only visible when printing */}
|
||||||
<div className="mt-6 text-center text-xs text-gray-500 hidden print:block">
|
<div className="mt-6 text-center text-xs text-gray-500 hidden print:block">
|
||||||
<p>{translations.printFooter.replace('{date}', new Date().toLocaleDateString())}</p>
|
<p>{translations.printFooter}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user