feat: add multilingual support for print preview empty state
Add i18n support for empty state when no barcode data is found:
**English translations:**
- "No Barcode Data Found"
- "No bills with 2D barcodes found for {yearMonth}"
**Croatian translations:**
- "Nema Podataka o Barkodovima"
- "Nema računa s 2D barkodovima za {yearMonth}"
**Implementation:**
- Add translation keys to messages/en.json and messages/hr.json
- Update server component to fetch empty state translations
- Use proper next-intl parameter passing for yearMonth variable
- Replace hardcoded English text with localized translations
Empty state now displays correct language based on URL locale:
- /en/print/2025/01 → English empty state message
- /hr/print/2025/01 → Croatian empty state message
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,7 @@ export default async function PrintPage({ params }: PrintPageProps) {
|
|||||||
|
|
||||||
// Get translations for the current locale
|
// Get translations for the current locale
|
||||||
const t = await getTranslations("home-page.print-preview");
|
const t = await getTranslations("home-page.print-preview");
|
||||||
|
const yearMonth = `${year}-${month.toString().padStart(2, '0')}`;
|
||||||
const translations = {
|
const translations = {
|
||||||
title: t("title"),
|
title: t("title"),
|
||||||
barcodesFound: t("barcodes-found"),
|
barcodesFound: t("barcodes-found"),
|
||||||
@@ -39,7 +40,9 @@ export default async function PrintPage({ params }: PrintPageProps) {
|
|||||||
printFooter: t("print-footer", { date: new Date().toLocaleDateString() }),
|
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"),
|
||||||
|
emptyStateTitle: t("empty-state-title"),
|
||||||
|
emptyStateMessage: t("empty-state-message", { yearMonth })
|
||||||
};
|
};
|
||||||
|
|
||||||
// If no barcode data found, show empty state
|
// If no barcode data found, show empty state
|
||||||
@@ -47,9 +50,9 @@ export default async function PrintPage({ params }: PrintPageProps) {
|
|||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center">
|
<div className="min-h-screen flex items-center justify-center">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<h1 className="text-2xl font-bold mb-4">No Barcode Data Found</h1>
|
<h1 className="text-2xl font-bold mb-4">{translations.emptyStateTitle}</h1>
|
||||||
<p className="text-gray-600">
|
<p className="text-gray-600">
|
||||||
No bills with 2D barcodes found for {year}-{month.toString().padStart(2, '0')}
|
{translations.emptyStateMessage}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -70,7 +70,9 @@
|
|||||||
"print-footer": "Generated on {date} • Evidencija Režija Print System",
|
"print-footer": "Generated on {date} • Evidencija Režija Print System",
|
||||||
"table-header-index": "#",
|
"table-header-index": "#",
|
||||||
"table-header-bill-info": "Bill Information",
|
"table-header-bill-info": "Bill Information",
|
||||||
"table-header-barcode": "2D Barcode"
|
"table-header-barcode": "2D Barcode",
|
||||||
|
"empty-state-title": "No Barcode Data Found",
|
||||||
|
"empty-state-message": "No bills with 2D barcodes found for {yearMonth}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bill-delete-form": {
|
"bill-delete-form": {
|
||||||
|
|||||||
@@ -70,7 +70,9 @@
|
|||||||
"print-footer": "Generirano {date} • Evidencija Režija Sustav Ispisa",
|
"print-footer": "Generirano {date} • Evidencija Režija Sustav Ispisa",
|
||||||
"table-header-index": "#",
|
"table-header-index": "#",
|
||||||
"table-header-bill-info": "Informacije o Računu",
|
"table-header-bill-info": "Informacije o Računu",
|
||||||
"table-header-barcode": "2D Barkod"
|
"table-header-barcode": "2D Barkod",
|
||||||
|
"empty-state-title": "Nema Podataka o Barkodovima",
|
||||||
|
"empty-state-message": "Nema računa s 2D barkodovima za {yearMonth}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bill-delete-form": {
|
"bill-delete-form": {
|
||||||
|
|||||||
Reference in New Issue
Block a user