Vertaalbestanden 5-6/6: placeholder-pagina en 'Boek {name}' naar de tekstbestanden; docs/translation-files.md
Placeholder: sjabloon met {{tokens}}, zinnen in core.host.placeholder.*; vergeleken met het originele bestand (zonder witruimte). 'Boek {name}' in offerings.injection.book; ASF-golden files blijven groen.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,13 @@ public static class OfferingsTexts
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Texts the host writes into the website's pages (the plain list of packages).</summary>
|
||||
public static class Injection
|
||||
{
|
||||
/// <summary>The booking link of a package; <c>{name}</c> is the package name, already HTML-encoded by the caller.</summary>
|
||||
public static readonly TextKey Book = new("offerings.injection.book", "name");
|
||||
}
|
||||
|
||||
/// <summary>The catalogue of the request being validated, or the shared default one outside a request (unit tests).</summary>
|
||||
public static ITextCatalog From(ValidationContext? context)
|
||||
=> context?.GetService(typeof(ITextCatalog)) as ITextCatalog ?? TextCatalog.Default;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using SlpModularCms.Core.Texts;
|
||||
using SlpModularCms.Modules.Offerings.Data.Entities;
|
||||
using SlpModularCms.Modules.Offerings.Models;
|
||||
|
||||
@@ -75,8 +76,9 @@ public static partial class CmsPageHtml
|
||||
/// <c>[a-z0-9-]+</c> (the first of a duplicate wins), it has a title, at least one feature (none blank) and a price
|
||||
/// that reads as whole euros above zero; the order is <c>displayOrder</c>.
|
||||
/// </summary>
|
||||
public static string OfferingsList(IReadOnlyList<OfferingDto> offerings)
|
||||
public static string OfferingsList(IReadOnlyList<OfferingDto> offerings, ITextCatalog? texts = null)
|
||||
{
|
||||
texts ??= TextCatalog.Default;
|
||||
var kept = Keep(offerings);
|
||||
if (kept.Count == 0)
|
||||
{
|
||||
@@ -99,7 +101,7 @@ public static partial class CmsPageHtml
|
||||
}
|
||||
|
||||
html.Append("</ul>")
|
||||
.Append("<a href=\"/?pakket=").Append(id).Append("#contact\">Boek ").Append(name).Append("</a>")
|
||||
.Append("<a href=\"/?pakket=").Append(id).Append("#contact\">").Append(texts.Get(OfferingsTexts.Injection.Book, args: ("name", name))).Append("</a>")
|
||||
.Append("</li>");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using SlpModularCms.Core.Hosting.Website;
|
||||
using SlpModularCms.Core.Texts;
|
||||
using SlpModularCms.Modules.Offerings.Data.Entities;
|
||||
using SlpModularCms.Modules.Offerings.Models;
|
||||
|
||||
@@ -12,7 +13,7 @@ namespace SlpModularCms.Modules.Offerings.Services;
|
||||
/// page's JSON-LD and inline prices. It only touches what a page marks; a page without markers is not handed to it.
|
||||
/// Any exception means "leave the page as it was built" (the injector logs it and serves the baked page).
|
||||
/// </summary>
|
||||
public sealed class OfferingsHtmlTransform(IOfferingsService offerings, IOfferingBannersService banners) : IHtmlPageTransform
|
||||
public sealed class OfferingsHtmlTransform(IOfferingsService offerings, IOfferingBannersService banners, ITextCatalog? texts = null) : IHtmlPageTransform
|
||||
{
|
||||
public const string OfferingsRegion = "CMS:OFFERINGS-HTML";
|
||||
public const string BannerTopRegion = "CMS:BANNER-TOP-HTML";
|
||||
@@ -48,7 +49,7 @@ public sealed class OfferingsHtmlTransform(IOfferingsService offerings, IOfferin
|
||||
|
||||
if (wantsOfferings)
|
||||
{
|
||||
html = HtmlMarkerEditor.ReplaceRegion(html, OfferingsRegion, CmsPageHtml.OfferingsList(live));
|
||||
html = HtmlMarkerEditor.ReplaceRegion(html, OfferingsRegion, CmsPageHtml.OfferingsList(live, texts));
|
||||
html = HtmlMarkerEditor.EditJsonLd(html, JsonLdMarker, (slug, json) => EditOfferJsonLd(json, FindPrice(live, slug)));
|
||||
html = HtmlMarkerEditor.ReplaceInlineValues(html, PriceAttribute,
|
||||
slug => FindPrice(live, slug) is { } euros ? CmsPageHtml.PriceHtml(euros) : null);
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
"schedule": {
|
||||
"endAfterStart": "EndsAt must be after StartsAt."
|
||||
}
|
||||
},
|
||||
"injection": {
|
||||
"book": "Book {name}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
"schedule": {
|
||||
"endAfterStart": "Het einde moet na het begin liggen."
|
||||
}
|
||||
},
|
||||
"injection": {
|
||||
"book": "Boek {name}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user