Vertaalbestanden 2b/6: mailteksten naar Texts/nl.json en en.json (core.mail.*), renderer via ITextCatalog; uitvoer byte-identiek (42 karakteriseringstests)
Geen gedragswijziging: benoemde plaatshouders {site}/{role}/{validity}/{name}/{count} i.p.v. {0}/{1}/{2}; uur/uren-meervoud in de bestanden.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -122,7 +122,7 @@ public class EmailAddressRulesTests
|
||||
|
||||
public class MailTemplateRendererTests
|
||||
{
|
||||
private readonly MailTemplateRenderer _renderer = new();
|
||||
private readonly MailTemplateRenderer _renderer = new(SlpModularCms.Core.Texts.TextCatalog.CreateDefault());
|
||||
private static MailModel Model(string site = "Andrea Slop Fotografie", string? action = "https://t.nl/admin/invite/complete?token=abc%2Fd", string? name = null) =>
|
||||
new(site, name, action, ValidForMinutes: 1440, Detail: "Administrator", LogoUrl: "https://t.nl/admin/brand-logo-on-light.png", BrandColor: "#2b6cb0");
|
||||
|
||||
@@ -434,7 +434,7 @@ public class MailPropertyTests(ITestOutputHelper output)
|
||||
public void Rendering_NeverThrows_NeverLeaksMarkup_AndKeepsTheSubjectOnOneLine() =>
|
||||
Check(s =>
|
||||
{
|
||||
var renderer = new MailTemplateRenderer();
|
||||
var renderer = new MailTemplateRenderer(SlpModularCms.Core.Texts.TextCatalog.CreateDefault());
|
||||
// Markers make the generated value findable inside the output.
|
||||
var site = "QQ" + s + "ZZ";
|
||||
var hasMarkup = s.IndexOfAny(['<', '>', '&', '"']) >= 0;
|
||||
@@ -483,7 +483,7 @@ public class MailPropertyTests(ITestOutputHelper output)
|
||||
/// <summary>NEW tests for the contact-message mail (details block, text part); the existing tests above are unchanged.</summary>
|
||||
public class ContactMessageMailRenderingTests
|
||||
{
|
||||
private readonly MailTemplateRenderer _renderer = new();
|
||||
private readonly MailTemplateRenderer _renderer = new(SlpModularCms.Core.Texts.TextCatalog.CreateDefault());
|
||||
|
||||
private static MailModel Model(params MailDetail[]? details) => new("De Site", Details: details);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class IdentityMailServiceTests
|
||||
_settings.GetEffectiveSenderAsync(Arg.Any<CancellationToken>()).Returns(("info@andreaslop.nl", "Andrea Slop Fotografie"));
|
||||
|
||||
private IdentityMailService Service(string smtpHost = "mail.example.nl", string defaultLanguage = "nl", int hours = 24, string logo = "/admin/brand-logo-on-light.png") =>
|
||||
new(_sender, new MailTemplateRenderer(),
|
||||
new(_sender, new MailTemplateRenderer(SlpModularCms.Core.Texts.TextCatalog.CreateDefault()),
|
||||
new LanguageResolver(Options.Create(new AppMailOptions { DefaultLanguage = defaultLanguage, PublicBaseUrl = "https://test.andreaslop.nl/" })),
|
||||
_settings,
|
||||
Options.Create(new EmailOptions { LogoUrl = logo, BrandColor = "#5f6a58", Smtp = { Host = smtpHost } }),
|
||||
|
||||
@@ -47,7 +47,7 @@ public class MailGoldenTests
|
||||
private static string Snapshot(MailKind kind, string language, string variant)
|
||||
{
|
||||
var model = variant == "full" ? Full(kind) : Bare();
|
||||
var mail = new MailTemplateRenderer().Render(kind, language, model);
|
||||
var mail = new MailTemplateRenderer(SlpModularCms.Core.Texts.TextCatalog.CreateDefault()).Render(kind, language, model);
|
||||
return new StringBuilder()
|
||||
.Append("SUBJECT: ").Append(mail.Subject).Append('\n')
|
||||
.Append("--HTML--\n").Append(mail.Html).Append('\n')
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using FluentAssertions;
|
||||
using SlpModularCms.Core.Texts;
|
||||
using Xunit;
|
||||
|
||||
namespace SlpModularCms.Core.Tests.Texts;
|
||||
|
||||
/// <summary>The texts in Core: every declared key has a text in every language, with the same placeholders, and no text is unused.</summary>
|
||||
public class CoreTextsTests
|
||||
{
|
||||
[Fact]
|
||||
public void TheCoreTextFiles_MatchTheDeclaredKeys_InDutchAndEnglish()
|
||||
=> TextAudit.Verify(typeof(TextCatalog).Assembly, TextAudit.KeysOf(typeof(CoreTexts)), "nl", "en").Should().BeEmpty();
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SlpModularCms.Core.Texts;
|
||||
|
||||
namespace SlpModularCms.Core.Email;
|
||||
|
||||
@@ -24,146 +25,83 @@ public sealed class LanguageResolver(IOptions<AppMailOptions> options) : ILangua
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One shared layout, texts per language kept in code. Every dynamic value is HTML-encoded for the
|
||||
/// HTML part; the subject and plain-text part carry the raw values (no markup there). A missing
|
||||
/// language or key falls back to Dutch. Table layout and inline CSS only, so it renders in mail clients.
|
||||
/// One shared layout; the sentences come from the text catalogue (<c>core.mail.*</c>, see <see cref="CoreTexts.Mail"/>).
|
||||
/// Every dynamic value is HTML-encoded for the HTML part; the subject and plain-text part carry the raw values (no
|
||||
/// markup there). A missing language or key falls back to Dutch. Table layout and inline CSS only, so it renders in
|
||||
/// mail clients.
|
||||
/// </summary>
|
||||
public sealed class MailTemplateRenderer : IMailTemplateRenderer
|
||||
public sealed class MailTemplateRenderer(ITextCatalog texts) : IMailTemplateRenderer
|
||||
{
|
||||
private const string DefaultColour = "#1f2937";
|
||||
|
||||
private sealed record Texts(
|
||||
string Subject, string Heading, string Intro, string? Button, string? Note, string Footer);
|
||||
private sealed record KindKeys(TextKey Subject, TextKey Heading, TextKey Intro, TextKey? Button, TextKey? Note);
|
||||
|
||||
// {0} = site name, {1} = role, {2} = minutes/hours text. Keys: kind, then language.
|
||||
private static readonly Dictionary<MailKind, Dictionary<string, Texts>> Catalog = new()
|
||||
private static readonly Dictionary<MailKind, KindKeys> Kinds = new()
|
||||
{
|
||||
[MailKind.Invitation] = new()
|
||||
{
|
||||
["nl"] = new("Uitnodiging voor {0}", "Je bent uitgenodigd",
|
||||
"Je bent uitgenodigd om een account aan te maken voor {0}. Kies met de knop hieronder je wachtwoord om je account te activeren.",
|
||||
"Account activeren", "Deze link is {2} geldig. Is hij verlopen, vraag dan de beheerder om een nieuwe uitnodiging.",
|
||||
"Deze mail is automatisch verstuurd door {0}."),
|
||||
["en"] = new("Invitation to {0}", "You have been invited",
|
||||
"You have been invited to create an account for {0}. Use the button below to choose your password and activate your account.",
|
||||
"Activate account", "This link is valid for {2}. If it has expired, ask the administrator for a new invitation.",
|
||||
"This message was sent automatically by {0}.")
|
||||
},
|
||||
[MailKind.NewInvitationLink] = new()
|
||||
{
|
||||
["nl"] = new("Nieuwe uitnodigingslink voor {0}", "Je hebt een nieuwe uitnodigingslink",
|
||||
"Er is een nieuwe uitnodigingslink voor je aangemaakt voor {0}. De vorige link werkt niet meer.",
|
||||
"Account activeren", "Deze link is {2} geldig.",
|
||||
"Deze mail is automatisch verstuurd door {0}."),
|
||||
["en"] = new("New invitation link for {0}", "You have a new invitation link",
|
||||
"A new invitation link has been created for you for {0}. The previous link no longer works.",
|
||||
"Activate account", "This link is valid for {2}.",
|
||||
"This message was sent automatically by {0}.")
|
||||
},
|
||||
[MailKind.PasswordReset] = new()
|
||||
{
|
||||
["nl"] = new("Wachtwoord opnieuw instellen voor {0}", "Wachtwoord opnieuw instellen",
|
||||
"Er is gevraagd om het wachtwoord van je account bij {0} opnieuw in te stellen. Gebruik de knop hieronder om een nieuw wachtwoord te kiezen.",
|
||||
"Nieuw wachtwoord kiezen", "Deze link is {2} geldig en werkt één keer. Heb jij dit niet gevraagd? Negeer deze mail dan: je wachtwoord blijft ongewijzigd.",
|
||||
"Deze mail is automatisch verstuurd door {0}."),
|
||||
["en"] = new("Reset your password for {0}", "Reset your password",
|
||||
"A request was made to reset the password of your account at {0}. Use the button below to choose a new password.",
|
||||
"Choose a new password", "This link is valid for {2} and works once. Did you not ask for this? Ignore this message: your password stays unchanged.",
|
||||
"This message was sent automatically by {0}.")
|
||||
},
|
||||
[MailKind.AccountDeactivated] = new()
|
||||
{
|
||||
["nl"] = new("Je account bij {0} is gedeactiveerd", "Account gedeactiveerd",
|
||||
"Een beheerder heeft je account bij {0} gedeactiveerd. Je kunt niet meer inloggen.",
|
||||
null, "Denk je dat dit niet klopt? Neem dan contact op met de beheerder.",
|
||||
"Deze mail is automatisch verstuurd door {0}."),
|
||||
["en"] = new("Your account at {0} has been deactivated", "Account deactivated",
|
||||
"An administrator has deactivated your account at {0}. You can no longer sign in.",
|
||||
null, "Think this is a mistake? Please contact the administrator.",
|
||||
"This message was sent automatically by {0}.")
|
||||
},
|
||||
[MailKind.AccountReactivated] = new()
|
||||
{
|
||||
["nl"] = new("Je account bij {0} is weer actief", "Account weer actief",
|
||||
"Een beheerder heeft je account bij {0} weer geactiveerd. Je kunt weer inloggen.",
|
||||
"Inloggen", null, "Deze mail is automatisch verstuurd door {0}."),
|
||||
["en"] = new("Your account at {0} is active again", "Account active again",
|
||||
"An administrator has reactivated your account at {0}. You can sign in again.",
|
||||
"Sign in", null, "This message was sent automatically by {0}.")
|
||||
},
|
||||
[MailKind.RoleChanged] = new()
|
||||
{
|
||||
["nl"] = new("Je rol bij {0} is gewijzigd", "Rol gewijzigd",
|
||||
"Een beheerder heeft je rol bij {0} gewijzigd naar: {1}.",
|
||||
null, "Denk je dat dit niet klopt? Neem dan contact op met de beheerder.",
|
||||
"Deze mail is automatisch verstuurd door {0}."),
|
||||
["en"] = new("Your role at {0} has changed", "Role changed",
|
||||
"An administrator has changed your role at {0} to: {1}.",
|
||||
null, "Think this is a mistake? Please contact the administrator.",
|
||||
"This message was sent automatically by {0}.")
|
||||
},
|
||||
[MailKind.Invitation] = new(CoreTexts.Mail.Invitation.Subject, CoreTexts.Mail.Invitation.Heading,
|
||||
CoreTexts.Mail.Invitation.Intro, CoreTexts.Mail.Invitation.Button, CoreTexts.Mail.Invitation.Note),
|
||||
[MailKind.NewInvitationLink] = new(CoreTexts.Mail.NewInvitationLink.Subject, CoreTexts.Mail.NewInvitationLink.Heading,
|
||||
CoreTexts.Mail.NewInvitationLink.Intro, CoreTexts.Mail.NewInvitationLink.Button, CoreTexts.Mail.NewInvitationLink.Note),
|
||||
[MailKind.PasswordReset] = new(CoreTexts.Mail.PasswordReset.Subject, CoreTexts.Mail.PasswordReset.Heading,
|
||||
CoreTexts.Mail.PasswordReset.Intro, CoreTexts.Mail.PasswordReset.Button, CoreTexts.Mail.PasswordReset.Note),
|
||||
[MailKind.AccountDeactivated] = new(CoreTexts.Mail.AccountDeactivated.Subject, CoreTexts.Mail.AccountDeactivated.Heading,
|
||||
CoreTexts.Mail.AccountDeactivated.Intro, null, CoreTexts.Mail.AccountDeactivated.Note),
|
||||
[MailKind.AccountReactivated] = new(CoreTexts.Mail.AccountReactivated.Subject, CoreTexts.Mail.AccountReactivated.Heading,
|
||||
CoreTexts.Mail.AccountReactivated.Intro, CoreTexts.Mail.AccountReactivated.Button, null),
|
||||
[MailKind.RoleChanged] = new(CoreTexts.Mail.RoleChanged.Subject, CoreTexts.Mail.RoleChanged.Heading,
|
||||
CoreTexts.Mail.RoleChanged.Intro, null, CoreTexts.Mail.RoleChanged.Note),
|
||||
// The details (name, e-mail address, subject, message) come from MailModel.Details; nothing the visitor
|
||||
// typed is part of the subject, which stays fixed text.
|
||||
[MailKind.ContactMessage] = new()
|
||||
{
|
||||
["nl"] = new("Nieuw bericht via {0}", "Nieuw bericht via het contactformulier",
|
||||
"Er is een bericht verstuurd via het contactformulier van {0}.",
|
||||
null, null,
|
||||
"Deze mail is automatisch verstuurd door {0}."),
|
||||
["en"] = new("New message via {0}", "New message from the contact form",
|
||||
"A message was sent through the contact form of {0}.",
|
||||
null, null,
|
||||
"This message was sent automatically by {0}.")
|
||||
}
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, Dictionary<string, string>> Roles = new()
|
||||
{
|
||||
["nl"] = new() { ["Owner"] = "Eigenaar", ["Administrator"] = "Beheerder", ["User"] = "Gebruiker" },
|
||||
["en"] = new() { ["Owner"] = "Owner", ["Administrator"] = "Administrator", ["User"] = "User" }
|
||||
[MailKind.ContactMessage] = new(CoreTexts.Mail.ContactMessage.Subject, CoreTexts.Mail.ContactMessage.Heading,
|
||||
CoreTexts.Mail.ContactMessage.Intro, null, null),
|
||||
};
|
||||
|
||||
public RenderedMail Render(MailKind kind, string language, MailModel model)
|
||||
{
|
||||
var lang = MailLanguages.Normalize(language) ?? MailLanguages.Dutch;
|
||||
var perKind = Catalog[kind];
|
||||
var t = perKind.TryGetValue(lang, out var found) ? found : perKind[MailLanguages.Dutch];
|
||||
var keys = Kinds[kind];
|
||||
|
||||
var site = Plain(model.SiteName);
|
||||
var role = RoleName(lang, model.Detail);
|
||||
var validity = Validity(lang, model.ValidForMinutes);
|
||||
|
||||
string F(string template) => string.Format(template, site, role, validity);
|
||||
string T(TextKey key) => texts.Get(key, lang, ("site", site), ("role", role), ("validity", validity));
|
||||
|
||||
var subject = Plain(F(t.Subject));
|
||||
var heading = F(t.Heading);
|
||||
var intro = F(t.Intro);
|
||||
var note = t.Note is null ? null : F(t.Note);
|
||||
var footer = F(t.Footer);
|
||||
var subject = Plain(T(keys.Subject));
|
||||
var heading = T(keys.Heading);
|
||||
var intro = T(keys.Intro);
|
||||
var note = keys.Note is null ? null : T(keys.Note);
|
||||
var footer = T(CoreTexts.Mail.Footer);
|
||||
var greeting = string.IsNullOrWhiteSpace(model.RecipientName)
|
||||
? null
|
||||
: (lang == "en" ? $"Hello {model.RecipientName.Trim()}," : $"Hallo {model.RecipientName.Trim()},");
|
||||
: texts.Get(CoreTexts.Mail.Greeting, lang, ("name", model.RecipientName.Trim()));
|
||||
var button = keys.Button is null ? null : T(keys.Button);
|
||||
|
||||
var colour = (EmailAddressRules.IsValidColour(model.BrandColor) ? model.BrandColor! : DefaultColour).ToLowerInvariant();
|
||||
var hasAction = t.Button is not null && !string.IsNullOrEmpty(model.ActionUrl);
|
||||
var hasAction = button is not null && !string.IsNullOrEmpty(model.ActionUrl);
|
||||
|
||||
return new RenderedMail(subject, BuildHtml(model, site, colour, greeting, heading, intro, hasAction ? t.Button : null, note, footer),
|
||||
return new RenderedMail(subject, BuildHtml(model, site, colour, greeting, heading, intro, hasAction ? button : null, note, footer),
|
||||
BuildText(greeting, heading, intro, hasAction ? model.ActionUrl : null, note, footer, model.Details));
|
||||
}
|
||||
|
||||
private static string RoleName(string lang, string? key) =>
|
||||
key is not null && Roles[lang].TryGetValue(key, out var name) ? name : (key ?? "");
|
||||
private string RoleName(string lang, string? key) => key switch
|
||||
{
|
||||
"Owner" => texts.Get(CoreTexts.Mail.RoleOwner, lang),
|
||||
"Administrator" => texts.Get(CoreTexts.Mail.RoleAdministrator, lang),
|
||||
"User" => texts.Get(CoreTexts.Mail.RoleUser, lang),
|
||||
_ => key ?? "",
|
||||
};
|
||||
|
||||
private static string Validity(string lang, int? minutes)
|
||||
private string Validity(string lang, int? minutes)
|
||||
{
|
||||
if (minutes is null) return "";
|
||||
var m = minutes.Value;
|
||||
if (m % 60 == 0)
|
||||
{
|
||||
var h = m / 60;
|
||||
return lang == "en" ? $"{h} hour{(h == 1 ? "" : "s")}" : $"{h} uur";
|
||||
return texts.Get(h == 1 ? CoreTexts.Mail.ValidityHoursOne : CoreTexts.Mail.ValidityHoursOther, lang, ("count", h));
|
||||
}
|
||||
return lang == "en" ? $"{m} minutes" : $"{m} minuten";
|
||||
return texts.Get(CoreTexts.Mail.ValidityMinutes, lang, ("count", m));
|
||||
}
|
||||
|
||||
/// <summary>For the subject and text: no markup, and no line breaks (a subject is a header).</summary>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
namespace SlpModularCms.Core.Texts;
|
||||
|
||||
/// <summary>
|
||||
/// The keys of the texts that live in Core (<c>Texts/nl.json</c>, <c>Texts/en.json</c>). A key is declared here with the
|
||||
/// placeholders every language version must contain; <see cref="TextAudit"/> checks the files against this list.
|
||||
/// </summary>
|
||||
public static class CoreTexts
|
||||
{
|
||||
/// <summary>Mails sent by the CMS (invitations, password reset, account changes, contact message). Key path <c>core.mail.*</c>.</summary>
|
||||
public static class Mail
|
||||
{
|
||||
public static readonly TextKey Greeting = new("core.mail.greeting", "name");
|
||||
public static readonly TextKey Footer = new("core.mail.footer", "site");
|
||||
|
||||
public static readonly TextKey RoleOwner = new("core.mail.role.owner");
|
||||
public static readonly TextKey RoleAdministrator = new("core.mail.role.administrator");
|
||||
public static readonly TextKey RoleUser = new("core.mail.role.user");
|
||||
|
||||
public static readonly TextKey ValidityHoursOne = new("core.mail.validity.hoursOne", "count");
|
||||
public static readonly TextKey ValidityHoursOther = new("core.mail.validity.hoursOther", "count");
|
||||
public static readonly TextKey ValidityMinutes = new("core.mail.validity.minutes", "count");
|
||||
|
||||
public static class Invitation
|
||||
{
|
||||
public static readonly TextKey Subject = new("core.mail.invitation.subject", "site");
|
||||
public static readonly TextKey Heading = new("core.mail.invitation.heading");
|
||||
public static readonly TextKey Intro = new("core.mail.invitation.intro", "site");
|
||||
public static readonly TextKey Button = new("core.mail.invitation.button");
|
||||
public static readonly TextKey Note = new("core.mail.invitation.note", "validity");
|
||||
}
|
||||
|
||||
public static class NewInvitationLink
|
||||
{
|
||||
public static readonly TextKey Subject = new("core.mail.newInvitationLink.subject", "site");
|
||||
public static readonly TextKey Heading = new("core.mail.newInvitationLink.heading");
|
||||
public static readonly TextKey Intro = new("core.mail.newInvitationLink.intro", "site");
|
||||
public static readonly TextKey Button = new("core.mail.newInvitationLink.button");
|
||||
public static readonly TextKey Note = new("core.mail.newInvitationLink.note", "validity");
|
||||
}
|
||||
|
||||
public static class PasswordReset
|
||||
{
|
||||
public static readonly TextKey Subject = new("core.mail.passwordReset.subject", "site");
|
||||
public static readonly TextKey Heading = new("core.mail.passwordReset.heading");
|
||||
public static readonly TextKey Intro = new("core.mail.passwordReset.intro", "site");
|
||||
public static readonly TextKey Button = new("core.mail.passwordReset.button");
|
||||
public static readonly TextKey Note = new("core.mail.passwordReset.note", "validity");
|
||||
}
|
||||
|
||||
public static class AccountDeactivated
|
||||
{
|
||||
public static readonly TextKey Subject = new("core.mail.accountDeactivated.subject", "site");
|
||||
public static readonly TextKey Heading = new("core.mail.accountDeactivated.heading");
|
||||
public static readonly TextKey Intro = new("core.mail.accountDeactivated.intro", "site");
|
||||
public static readonly TextKey Note = new("core.mail.accountDeactivated.note");
|
||||
}
|
||||
|
||||
public static class AccountReactivated
|
||||
{
|
||||
public static readonly TextKey Subject = new("core.mail.accountReactivated.subject", "site");
|
||||
public static readonly TextKey Heading = new("core.mail.accountReactivated.heading");
|
||||
public static readonly TextKey Intro = new("core.mail.accountReactivated.intro", "site");
|
||||
public static readonly TextKey Button = new("core.mail.accountReactivated.button");
|
||||
}
|
||||
|
||||
public static class RoleChanged
|
||||
{
|
||||
public static readonly TextKey Subject = new("core.mail.roleChanged.subject", "site");
|
||||
public static readonly TextKey Heading = new("core.mail.roleChanged.heading");
|
||||
public static readonly TextKey Intro = new("core.mail.roleChanged.intro", "site", "role");
|
||||
public static readonly TextKey Note = new("core.mail.roleChanged.note");
|
||||
}
|
||||
|
||||
public static class ContactMessage
|
||||
{
|
||||
public static readonly TextKey Subject = new("core.mail.contactMessage.subject", "site");
|
||||
public static readonly TextKey Heading = new("core.mail.contactMessage.heading");
|
||||
public static readonly TextKey Intro = new("core.mail.contactMessage.intro", "site");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,6 +88,16 @@ public sealed partial class TextCatalog : ITextCatalog
|
||||
_folder = LoadFolder(options.Value.Directory, logger);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A catalogue over the texts embedded in Core (and any extra assemblies), default language Dutch, no override layers.
|
||||
/// For code that has no dependency injection (and tests); the hosts use <c>AddCmsTexts</c>.
|
||||
/// </summary>
|
||||
public static TextCatalog CreateDefault(params Assembly[] extraAssemblies) => new(
|
||||
Options.Create(new TextsOptions()),
|
||||
new[] { new TextAssembly(typeof(TextCatalog).Assembly) }.Concat(extraAssemblies.Select(a => new TextAssembly(a))),
|
||||
[],
|
||||
Microsoft.Extensions.Logging.Abstractions.NullLogger<TextCatalog>.Instance);
|
||||
|
||||
/// <summary>The languages that have embedded texts.</summary>
|
||||
public IReadOnlyCollection<string> Languages => _embedded.Keys;
|
||||
|
||||
|
||||
@@ -1,2 +1,62 @@
|
||||
{
|
||||
"core": {
|
||||
"mail": {
|
||||
"greeting": "Hello {name},",
|
||||
"footer": "This message was sent automatically by {site}.",
|
||||
"role": {
|
||||
"owner": "Owner",
|
||||
"administrator": "Administrator",
|
||||
"user": "User"
|
||||
},
|
||||
"validity": {
|
||||
"hoursOne": "{count} hour",
|
||||
"hoursOther": "{count} hours",
|
||||
"minutes": "{count} minutes"
|
||||
},
|
||||
"invitation": {
|
||||
"subject": "Invitation to {site}",
|
||||
"heading": "You have been invited",
|
||||
"intro": "You have been invited to create an account for {site}. Use the button below to choose your password and activate your account.",
|
||||
"button": "Activate account",
|
||||
"note": "This link is valid for {validity}. If it has expired, ask the administrator for a new invitation."
|
||||
},
|
||||
"newInvitationLink": {
|
||||
"subject": "New invitation link for {site}",
|
||||
"heading": "You have a new invitation link",
|
||||
"intro": "A new invitation link has been created for you for {site}. The previous link no longer works.",
|
||||
"button": "Activate account",
|
||||
"note": "This link is valid for {validity}."
|
||||
},
|
||||
"passwordReset": {
|
||||
"subject": "Reset your password for {site}",
|
||||
"heading": "Reset your password",
|
||||
"intro": "A request was made to reset the password of your account at {site}. Use the button below to choose a new password.",
|
||||
"button": "Choose a new password",
|
||||
"note": "This link is valid for {validity} and works once. Did you not ask for this? Ignore this message: your password stays unchanged."
|
||||
},
|
||||
"accountDeactivated": {
|
||||
"subject": "Your account at {site} has been deactivated",
|
||||
"heading": "Account deactivated",
|
||||
"intro": "An administrator has deactivated your account at {site}. You can no longer sign in.",
|
||||
"note": "Think this is a mistake? Please contact the administrator."
|
||||
},
|
||||
"accountReactivated": {
|
||||
"subject": "Your account at {site} is active again",
|
||||
"heading": "Account active again",
|
||||
"intro": "An administrator has reactivated your account at {site}. You can sign in again.",
|
||||
"button": "Sign in"
|
||||
},
|
||||
"roleChanged": {
|
||||
"subject": "Your role at {site} has changed",
|
||||
"heading": "Role changed",
|
||||
"intro": "An administrator has changed your role at {site} to: {role}.",
|
||||
"note": "Think this is a mistake? Please contact the administrator."
|
||||
},
|
||||
"contactMessage": {
|
||||
"subject": "New message via {site}",
|
||||
"heading": "New message from the contact form",
|
||||
"intro": "A message was sent through the contact form of {site}."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,62 @@
|
||||
{
|
||||
"core": {
|
||||
"mail": {
|
||||
"greeting": "Hallo {name},",
|
||||
"footer": "Deze mail is automatisch verstuurd door {site}.",
|
||||
"role": {
|
||||
"owner": "Eigenaar",
|
||||
"administrator": "Beheerder",
|
||||
"user": "Gebruiker"
|
||||
},
|
||||
"validity": {
|
||||
"hoursOne": "{count} uur",
|
||||
"hoursOther": "{count} uur",
|
||||
"minutes": "{count} minuten"
|
||||
},
|
||||
"invitation": {
|
||||
"subject": "Uitnodiging voor {site}",
|
||||
"heading": "Je bent uitgenodigd",
|
||||
"intro": "Je bent uitgenodigd om een account aan te maken voor {site}. Kies met de knop hieronder je wachtwoord om je account te activeren.",
|
||||
"button": "Account activeren",
|
||||
"note": "Deze link is {validity} geldig. Is hij verlopen, vraag dan de beheerder om een nieuwe uitnodiging."
|
||||
},
|
||||
"newInvitationLink": {
|
||||
"subject": "Nieuwe uitnodigingslink voor {site}",
|
||||
"heading": "Je hebt een nieuwe uitnodigingslink",
|
||||
"intro": "Er is een nieuwe uitnodigingslink voor je aangemaakt voor {site}. De vorige link werkt niet meer.",
|
||||
"button": "Account activeren",
|
||||
"note": "Deze link is {validity} geldig."
|
||||
},
|
||||
"passwordReset": {
|
||||
"subject": "Wachtwoord opnieuw instellen voor {site}",
|
||||
"heading": "Wachtwoord opnieuw instellen",
|
||||
"intro": "Er is gevraagd om het wachtwoord van je account bij {site} opnieuw in te stellen. Gebruik de knop hieronder om een nieuw wachtwoord te kiezen.",
|
||||
"button": "Nieuw wachtwoord kiezen",
|
||||
"note": "Deze link is {validity} geldig en werkt één keer. Heb jij dit niet gevraagd? Negeer deze mail dan: je wachtwoord blijft ongewijzigd."
|
||||
},
|
||||
"accountDeactivated": {
|
||||
"subject": "Je account bij {site} is gedeactiveerd",
|
||||
"heading": "Account gedeactiveerd",
|
||||
"intro": "Een beheerder heeft je account bij {site} gedeactiveerd. Je kunt niet meer inloggen.",
|
||||
"note": "Denk je dat dit niet klopt? Neem dan contact op met de beheerder."
|
||||
},
|
||||
"accountReactivated": {
|
||||
"subject": "Je account bij {site} is weer actief",
|
||||
"heading": "Account weer actief",
|
||||
"intro": "Een beheerder heeft je account bij {site} weer geactiveerd. Je kunt weer inloggen.",
|
||||
"button": "Inloggen"
|
||||
},
|
||||
"roleChanged": {
|
||||
"subject": "Je rol bij {site} is gewijzigd",
|
||||
"heading": "Rol gewijzigd",
|
||||
"intro": "Een beheerder heeft je rol bij {site} gewijzigd naar: {role}.",
|
||||
"note": "Denk je dat dit niet klopt? Neem dan contact op met de beheerder."
|
||||
},
|
||||
"contactMessage": {
|
||||
"subject": "Nieuw bericht via {site}",
|
||||
"heading": "Nieuw bericht via het contactformulier",
|
||||
"intro": "Er is een bericht verstuurd via het contactformulier van {site}."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ContactMailSenderTests
|
||||
var settings = Substitute.For<ISiteSettingsService>();
|
||||
settings.GetEffectiveSenderAsync(Arg.Any<CancellationToken>()).Returns(("noreply@example.org", "De Site"));
|
||||
return new ContactMailSender(
|
||||
Email, new MailTemplateRenderer(), languages, settings, ContactSettings, Availability,
|
||||
Email, new MailTemplateRenderer(SlpModularCms.Core.Texts.TextCatalog.CreateDefault()), languages, settings, ContactSettings, Availability,
|
||||
Options.Create(new EmailOptions()), Options.Create(new AppMailOptions { PublicBaseUrl = "https://example.org" }),
|
||||
Options.Create(Contact), LoggerFactory.Create(b => b.AddProvider(Logs)).CreateLogger<ContactMailSender>());
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class ContactRecipientTests : IDisposable
|
||||
siteSettings.GetEffectiveSenderAsync(Arg.Any<CancellationToken>()).Returns(("noreply@example.org", "De Site"));
|
||||
var settings = Settings();
|
||||
var sender = new ContactMailSender(
|
||||
email, new MailTemplateRenderer(), languages, siteSettings, settings, availability,
|
||||
email, new MailTemplateRenderer(SlpModularCms.Core.Texts.TextCatalog.CreateDefault()), languages, siteSettings, settings, availability,
|
||||
Options.Create(new EmailOptions()), Options.Create(new AppMailOptions { PublicBaseUrl = "https://example.org" }),
|
||||
Options.Create(_options), LoggerFactory.Create(_ => { }).CreateLogger<ContactMailSender>());
|
||||
var message = new ContactMessage { Id = Guid.NewGuid(), SiteId = "s", Name = "Jan", Email = "jan@example.nl", Subject = "Website", Message = "Hallo" };
|
||||
@@ -156,7 +156,7 @@ public class ContactRecipientTests : IDisposable
|
||||
var availability = Substitute.For<IMailAvailability>();
|
||||
availability.IsEnabled.Returns(true);
|
||||
var sender = new ContactMailSender(
|
||||
email, new MailTemplateRenderer(), Substitute.For<ILanguageResolver>(), Substitute.For<ISiteSettingsService>(), Settings(), availability,
|
||||
email, new MailTemplateRenderer(SlpModularCms.Core.Texts.TextCatalog.CreateDefault()), Substitute.For<ILanguageResolver>(), Substitute.For<ISiteSettingsService>(), Settings(), availability,
|
||||
Options.Create(new EmailOptions()), Options.Create(new AppMailOptions()), Options.Create(_options),
|
||||
LoggerFactory.Create(_ => { }).CreateLogger<ContactMailSender>());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user