fixed hard-code English in report system
This commit is contained in:
parent
79f695f9b4
commit
7df4842980
|
|
@ -159,7 +159,10 @@ function FormattedBullet({ text }: { text: string }) {
|
||||||
return <>{parts}</>;
|
return <>{parts}</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MONTH_NAMES = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
function getMonthName(month: number, locale: string): string {
|
||||||
|
const date = new Date(2000, month - 1, 1);
|
||||||
|
return date.toLocaleDateString(locale, { month: 'long' });
|
||||||
|
}
|
||||||
|
|
||||||
// ── Email Bar (shared) ──────────────────────────────────────────
|
// ── Email Bar (shared) ──────────────────────────────────────────
|
||||||
|
|
||||||
|
|
@ -545,7 +548,7 @@ function WeeklySection({ installationId, latestMonthlyPeriodEnd }: { installatio
|
||||||
</Box>
|
</Box>
|
||||||
{report.dailyData.map((d, i) => {
|
{report.dailyData.map((d, i) => {
|
||||||
const dt = new Date(d.date);
|
const dt = new Date(d.date);
|
||||||
const dayLabel = dt.toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric' });
|
const dayLabel = dt.toLocaleDateString(intl.locale, { weekday: 'short', month: 'short', day: 'numeric' });
|
||||||
const isCurrentWeek = report.dailyData.length > 7 ? i >= report.dailyData.length - 7 : true;
|
const isCurrentWeek = report.dailyData.length > 7 ? i >= report.dailyData.length - 7 : true;
|
||||||
return (
|
return (
|
||||||
<Box key={d.date} sx={{ mb: 1.5, opacity: isCurrentWeek ? 1 : 0.6 }}>
|
<Box key={d.date} sx={{ mb: 1.5, opacity: isCurrentWeek ? 1 : 0.6 }}>
|
||||||
|
|
@ -555,7 +558,7 @@ function WeeklySection({ installationId, latestMonthlyPeriodEnd }: { installatio
|
||||||
{!isCurrentWeek && <span style={{ color: '#999', marginLeft: 4 }}><FormattedMessage id="prevWeek" defaultMessage="(prev week)" /></span>}
|
{!isCurrentWeek && <span style={{ color: '#999', marginLeft: 4 }}><FormattedMessage id="prevWeek" defaultMessage="(prev week)" /></span>}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="caption" sx={{ color: '#888', fontSize: '11px' }}>
|
<Typography variant="caption" sx={{ color: '#888', fontSize: '11px' }}>
|
||||||
PV {d.pvProduction.toFixed(1)} | Load {d.loadConsumption.toFixed(1)} | Grid {d.gridImport.toFixed(1)} kWh
|
{intl.formatMessage({ id: 'pvProduction' })} {d.pvProduction.toFixed(1)} | {intl.formatMessage({ id: 'consumption' })} {d.loadConsumption.toFixed(1)} | {intl.formatMessage({ id: 'gridImport' })} {d.gridImport.toFixed(1)} kWh
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<Box sx={{ display: 'flex', gap: '2px', height: 18 }}>
|
<Box sx={{ display: 'flex', gap: '2px', height: 18 }}>
|
||||||
|
|
@ -737,7 +740,7 @@ function MonthlySection({
|
||||||
? intl.formatMessage({ id: 'generatingMonthly', defaultMessage: 'Generating...' })
|
? intl.formatMessage({ id: 'generatingMonthly', defaultMessage: 'Generating...' })
|
||||||
: intl.formatMessage(
|
: intl.formatMessage(
|
||||||
{ id: 'generateMonth', defaultMessage: 'Generate {month} {year} ({count} weeks)' },
|
{ id: 'generateMonth', defaultMessage: 'Generate {month} {year} ({count} weeks)' },
|
||||||
{ month: MONTH_NAMES[p.month], year: p.year, count: p.weekCount }
|
{ month: getMonthName(p.month, intl.locale), year: p.year, count: p.weekCount }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
@ -752,7 +755,7 @@ function MonthlySection({
|
||||||
<AggregatedSection
|
<AggregatedSection
|
||||||
reports={reports}
|
reports={reports}
|
||||||
type="monthly"
|
type="monthly"
|
||||||
labelFn={(r: MonthlyReport) => `${MONTH_NAMES[r.month]} ${r.year}`}
|
labelFn={(r: MonthlyReport) => `${getMonthName(r.month, intl.locale)} ${r.year}`}
|
||||||
countLabelId="weeksAggregated"
|
countLabelId="weeksAggregated"
|
||||||
countFn={(r: MonthlyReport) => r.weekCount}
|
countFn={(r: MonthlyReport) => r.weekCount}
|
||||||
sendEndpoint="/SendMonthlyReportEmail"
|
sendEndpoint="/SendMonthlyReportEmail"
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,7 @@
|
||||||
"generatingMonthly": "Wird generiert...",
|
"generatingMonthly": "Wird generiert...",
|
||||||
"generatingYearly": "Wird generiert...",
|
"generatingYearly": "Wird generiert...",
|
||||||
"thisMonthWeeklyReports": "Wöchentliche Berichte dieses Monats",
|
"thisMonthWeeklyReports": "Wöchentliche Berichte dieses Monats",
|
||||||
|
"recentWeeklyReports": "Letzte Wochenberichte",
|
||||||
"ai_analyzing": "KI analysiert...",
|
"ai_analyzing": "KI analysiert...",
|
||||||
"ai_show_details": "Details anzeigen",
|
"ai_show_details": "Details anzeigen",
|
||||||
"ai_show_less": "Weniger anzeigen",
|
"ai_show_less": "Weniger anzeigen",
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@
|
||||||
"generatingMonthly": "Generating...",
|
"generatingMonthly": "Generating...",
|
||||||
"generatingYearly": "Generating...",
|
"generatingYearly": "Generating...",
|
||||||
"thisMonthWeeklyReports": "This Month's Weekly Reports",
|
"thisMonthWeeklyReports": "This Month's Weekly Reports",
|
||||||
|
"recentWeeklyReports": "Recent Weekly Reports",
|
||||||
"ai_analyzing": "AI is analyzing...",
|
"ai_analyzing": "AI is analyzing...",
|
||||||
"ai_show_details": "Show details",
|
"ai_show_details": "Show details",
|
||||||
"ai_show_less": "Show less",
|
"ai_show_less": "Show less",
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,7 @@
|
||||||
"generatingMonthly": "Génération en cours...",
|
"generatingMonthly": "Génération en cours...",
|
||||||
"generatingYearly": "Génération en cours...",
|
"generatingYearly": "Génération en cours...",
|
||||||
"thisMonthWeeklyReports": "Rapports hebdomadaires de ce mois",
|
"thisMonthWeeklyReports": "Rapports hebdomadaires de ce mois",
|
||||||
|
"recentWeeklyReports": "Derniers rapports hebdomadaires",
|
||||||
"ai_analyzing": "L'IA analyse...",
|
"ai_analyzing": "L'IA analyse...",
|
||||||
"ai_show_details": "Afficher les détails",
|
"ai_show_details": "Afficher les détails",
|
||||||
"ai_show_less": "Afficher moins",
|
"ai_show_less": "Afficher moins",
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,7 @@
|
||||||
"generatingMonthly": "Generazione in corso...",
|
"generatingMonthly": "Generazione in corso...",
|
||||||
"generatingYearly": "Generazione in corso...",
|
"generatingYearly": "Generazione in corso...",
|
||||||
"thisMonthWeeklyReports": "Rapporti settimanali di questo mese",
|
"thisMonthWeeklyReports": "Rapporti settimanali di questo mese",
|
||||||
|
"recentWeeklyReports": "Ultimi rapporti settimanali",
|
||||||
"ai_analyzing": "L'IA sta analizzando...",
|
"ai_analyzing": "L'IA sta analizzando...",
|
||||||
"ai_show_details": "Mostra dettagli",
|
"ai_show_details": "Mostra dettagli",
|
||||||
"ai_show_less": "Mostra meno",
|
"ai_show_less": "Mostra meno",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue