Fix hardcoded user-facing strings — localize email fallbacks, API errors, AI parse messages
- Frontend: update extractApiError to check body.code first via i18n 'error.<code>' keys; add en/ro translations for cv_file_missing, captcha_verification_failed, request_cancelled - email-data migration: seed 6 fallback template keys (match N/A, subject label, unknown IP, job search results empty states for keywords/providers/location) - EmailApiEmailSender: replace "N/A", "Job", "Unknown" literals with template lookups - CvSearchEmailSender: replace "none detected", "none", "-" literals with template lookups - cv-matcher-data migration: seed parse-error.summary and parse-error.recommendation in AiPrompts - CvMatcherService: look up localized parse-error messages from AiPrompts before calling ParseResult Closes #53 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+69
@@ -0,0 +1,69 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Email.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Email.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(EmailDbContext))]
|
||||
[Migration("20260608192938_AddFallbackStringTemplates")]
|
||||
partial class AddFallbackStringTemplates
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("email")
|
||||
.HasAnnotation("ProductVersion", "10.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Email.Data.Entities.EmailTemplateEntity", b =>
|
||||
{
|
||||
b.Property<string>("Key")
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("nvarchar(128)");
|
||||
|
||||
b.Property<string>("Language")
|
||||
.HasMaxLength(8)
|
||||
.HasColumnType("nvarchar(8)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("nvarchar(500)")
|
||||
.HasDefaultValue("");
|
||||
|
||||
b.Property<string>("OperatorCopy")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("nvarchar(256)")
|
||||
.HasDefaultValue("");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("datetime2")
|
||||
.HasDefaultValueSql("SYSUTCDATETIME()");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Key", "Language");
|
||||
|
||||
b.ToTable("Templates", "email");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
using Email.Data;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Email.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddFallbackStringTemplates : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.match.fallback-na", "en", "N/A", "Fallback when a match email field (job label or URL) has no value"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.match.fallback-na", "ro", "N/A", "Fallback când un câmp al emailului de potrivire (etichetă job sau URL) nu are valoare"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.match.subject-fallback-label", "en", "Job", "Fallback job label used in match email subject when no specific label is available"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.match.subject-fallback-label", "ro", "Job", "Etichetă fallback pentru subiectul emailului de potrivire când nu există o etichetă specifică"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.notification.unknown-ip", "en", "Unknown", "Fallback IP address label in operator notification emails"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.notification.unknown-ip", "ro", "Necunoscut", "Etichetă fallback pentru adresa IP în emailurile de notificare operator"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.search-results.keywords-empty", "en", "none detected", "Text shown in job search results email when no CV keywords were extracted"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.search-results.keywords-empty", "ro", "niciunul detectat", "Text afișat în emailul cu rezultatele căutării când nu au fost extrase cuvinte cheie din CV"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.search-results.providers-empty", "en", "none", "Text shown in job search results email when no providers were searched"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.search-results.providers-empty", "ro", "niciunul", "Text afișat în emailul cu rezultatele căutării când nu au fost căutați furnizori"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.search-results.location-empty", "en", "-", "Fallback location display in job search results email scan summary"]);
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
columns: ["Key", "Language", "Value", "Description"],
|
||||
values: ["email.search-results.location-empty", "ro", "-", "Afișaj fallback pentru locație în sumarului de scanare al emailului cu rezultatele căutării"]);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.match.fallback-na", "en"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.match.fallback-na", "ro"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.match.subject-fallback-label", "en"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.match.subject-fallback-label", "ro"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.notification.unknown-ip", "en"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.notification.unknown-ip", "ro"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.search-results.keywords-empty", "en"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.search-results.keywords-empty", "ro"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.search-results.providers-empty", "en"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.search-results.providers-empty", "ro"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.search-results.location-empty", "en"]);
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
schema: MigrationConstants.SchemaName,
|
||||
table: "Templates",
|
||||
keyColumns: ["Key", "Language"],
|
||||
keyValues: ["email.search-results.location-empty", "ro"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user