fix(i18n): localize generated labels without changing saved content
This commit is contained in:
@@ -404,6 +404,15 @@ export function SubmittedPackagesSection({ jobId, allowCapture = true }: { jobId
|
||||
|
||||
// ---------- Tailoring ----------
|
||||
|
||||
const tailoringLabels = new Map<string, [TranslationKey, TranslationKey]>([
|
||||
["highlight-skills", ["assetsTailoringHighlightTitle", "assetsTailoringHighlightDetail"]],
|
||||
["prioritise-experience", ["assetsTailoringExperienceTitle", "assetsTailoringExperienceDetail"]],
|
||||
["emphasise-projects", ["assetsTailoringProjectsTitle", "assetsTailoringProjectsDetail"]],
|
||||
["career-evidence", ["assetsTailoringEvidenceTitle", "assetsTailoringEvidenceDetail"]],
|
||||
["include-keywords", ["assetsTailoringKeywordsTitle", "assetsTailoringKeywordsDetail"]],
|
||||
["gaps", ["assetsTailoringGapsTitle", "assetsTailoringGapsDetail"]],
|
||||
]);
|
||||
|
||||
export function ApplicationTailoringSection({ jobId }: { jobId: number }) {
|
||||
const { t } = useI18n();
|
||||
const { data, error, loading, reload } = useAsset<TailoringPlan>(
|
||||
@@ -437,11 +446,13 @@ export function ApplicationTailoringSection({ jobId }: { jobId: number }) {
|
||||
{t("assetsNoSuggestions")}
|
||||
</Typography>
|
||||
) : (
|
||||
(data?.suggestions ?? []).map((s) => (
|
||||
(data?.suggestions ?? []).map((s) => {
|
||||
const labels = tailoringLabels.get(s.kind);
|
||||
return (
|
||||
<Box key={s.kind}>
|
||||
<Typography variant="body2" sx={{ fontWeight: 700 }}>{s.title}</Typography>
|
||||
<Typography variant="body2" sx={{ fontWeight: 700 }}>{labels ? t(labels[0]) : s.title}</Typography>
|
||||
{s.detail && (
|
||||
<Typography variant="caption" color="text.secondary">{s.detail}</Typography>
|
||||
<Typography variant="caption" color="text.secondary">{labels ? t(labels[1]) : s.detail}</Typography>
|
||||
)}
|
||||
<Stack direction="row" flexWrap="wrap" gap={0.5} sx={{ mt: 0.75 }}>
|
||||
{s.items.map((item) => (
|
||||
@@ -449,7 +460,7 @@ export function ApplicationTailoringSection({ jobId }: { jobId: number }) {
|
||||
))}
|
||||
</Stack>
|
||||
</Box>
|
||||
))
|
||||
); })
|
||||
)}
|
||||
</Stack>
|
||||
</Shell>
|
||||
@@ -458,6 +469,18 @@ export function ApplicationTailoringSection({ jobId }: { jobId: number }) {
|
||||
|
||||
// ---------- Cover letter ----------
|
||||
|
||||
const historySources = new Map<string, TranslationKey>([
|
||||
["manual", "historySourceManual"], ["ai", "historySourceAi"],
|
||||
["template", "historySourceTemplate"], ["restore", "historySourceRestore"],
|
||||
]);
|
||||
const historyAiActions = new Map<string, TranslationKey>([
|
||||
["generate", "coverActionGenerate"], ["regenerate", "coverActionRegenerate"],
|
||||
["improve", "coverActionImprove"], ["shorten", "coverActionShorten"],
|
||||
["expand", "coverActionExpand"], ["professional", "coverActionProfessional"],
|
||||
["natural", "coverActionNatural"], ["grammar", "coverActionGrammar"],
|
||||
["tone", "coverAiTone"], ["tailor", "coverActionTailor"],
|
||||
]);
|
||||
|
||||
const COVER_LETTER_TEMPLATES = {
|
||||
en: `Dear Hiring Manager,
|
||||
|
||||
@@ -615,7 +638,12 @@ export function ApplicationCoverLetterSection({ jobId, onDirtyChange }: { jobId:
|
||||
</Typography>
|
||||
) : (
|
||||
<Stack spacing={0.5}>
|
||||
{(data?.versions ?? []).map((v) => (
|
||||
{(data?.versions ?? []).map((v) => {
|
||||
const sourceKey = historySources.get(v.source);
|
||||
const actionKey = historyAiActions.get(v.aiAction ?? "");
|
||||
const source = sourceKey ? t(sourceKey) : v.source;
|
||||
const action = actionKey ? t(actionKey) : v.aiAction;
|
||||
return (
|
||||
<Stack
|
||||
key={v.version}
|
||||
direction="row"
|
||||
@@ -626,7 +654,7 @@ export function ApplicationCoverLetterSection({ jobId, onDirtyChange }: { jobId:
|
||||
<Box sx={{ minWidth: 0 }}>
|
||||
<Stack direction="row" spacing={0.75} alignItems="center" flexWrap="wrap">
|
||||
<Typography variant="body2" sx={{ fontWeight: 600 }}>v{v.version}</Typography>
|
||||
<Chip size="small" variant="outlined" label={v.aiAction ? `${v.source} · ${v.aiAction}` : v.source} />
|
||||
<Chip size="small" variant="outlined" label={action ? `${source} · ${action}` : source} />
|
||||
{v.isCurrent && <Chip size="small" color="primary" variant="outlined" label={t("assetsCurrent")} />}
|
||||
</Stack>
|
||||
<Typography variant="caption" color="text.secondary">
|
||||
@@ -648,7 +676,7 @@ export function ApplicationCoverLetterSection({ jobId, onDirtyChange }: { jobId:
|
||||
</Tooltip>
|
||||
)}
|
||||
</Stack>
|
||||
))}
|
||||
); })}
|
||||
</Stack>
|
||||
)}
|
||||
</Shell>
|
||||
|
||||
Reference in New Issue
Block a user