Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</ItemGroup>

<ItemGroup Label="UI">
<PackageVersion Include="AndreGoepel.Design.Blazor" Version="1.4.2" />
<PackageVersion Include="AndreGoepel.Design.Blazor" Version="1.6.0" />
<PackageVersion Include="Radzen.Blazor" Version="11.1.7" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup Label="Web (kept in step with the libraries under /src)">
<PackageVersion Include="AndreGoepel.Design.Blazor" Version="1.4.2" />
<PackageVersion Include="AndreGoepel.Design.Blazor" Version="1.6.0" />
<PackageVersion Include="Marten" Version="9.19.0" />
<PackageVersion Include="Radzen.Blazor" Version="11.1.7" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,44 +1,20 @@
using AndreGoepel.Design.Blazor.Components;
using AndreGoepel.Marten.Identity.Blazor.Resources;
using Microsoft.AspNetCore.Components;

namespace AndreGoepel.Marten.Identity.Blazor.Components;

/// <summary>
/// Base for identity UI components that render their own text via <see cref="T(string)"/>
/// instead of a page-local copy of the same helper (#114).
/// Base for identity UI components that render their own text via <c>T(string)</c> instead of a
/// page-local copy of the same helper (#114). Thin subclass of the design system's generic
/// <see cref="LocalizedComponentBase{TMarker}"/> closed over <see cref="IdentityStrings"/>, so
/// pages can <c>@inherits IdentityLocalizedComponentBase</c> without spelling out the closed
/// generic name.
/// </summary>
/// <remarks>
/// A component must not <c>@inject IStringLocalizer&lt;IdentityStrings&gt;</c> directly: that
/// is a required injection, so rendering it throws on any host — or bUnit test — that never
/// called <c>AddMartenIdentityBlazor</c>. Resolving through <see cref="IServiceProvider"/>
/// instead avoids that, which is why every translated page needs the same pair of methods;
/// this base class is the one place that pair is defined. Inherit it with <c>@inherits
/// IdentityLocalizedComponentBase</c> rather than repeating <c>@inject IServiceProvider
/// Services</c> + the two <c>T</c> overloads in each page.
/// <para>
/// Not to be confused with — or replaced by — <c>LocalizedComponentBase</c> from
/// AndreGoepel.Design.Blazor: that one resolves against the design system's own
/// <c>DesignStrings</c> resx and returns the key unchanged for anything it does not know,
/// so inheriting it here renders every identity page as raw resource keys. The name differs
/// deliberately: <c>_Imports.razor</c> pulls in both namespaces, so a shared name would be
/// ambiguous (CS0104).
/// </para>
/// <para>
/// Public rather than internal: the Razor compiler generates a routable (<c>@page</c>)
/// component's partial class as public, and a public class cannot derive from an internal
/// base (CS0060). Not intended for use outside this assembly regardless.
/// </para>
/// Not to be confused with — or replaced by — <c>AndreGoepel.Design.Blazor</c>'s own non-generic
/// <c>LocalizedComponentBase</c>: that one is closed over the design system's own
/// <c>DesignStrings</c> resx, not <see cref="IdentityStrings"/>. The name differs from the
/// generic base deliberately: <c>_Imports.razor</c> pulls in both namespaces, so a shared name
/// would be ambiguous (CS0104).
/// </remarks>
public abstract class IdentityLocalizedComponentBase : ComponentBase
{
[Inject]
private IServiceProvider Services { get; set; } = default!;

/// <summary>Looks up <paramref name="key"/> for the current UI culture.</summary>
protected string T(string key) => Services.IdentityText(key);

/// <inheritdoc cref="T(string)"/>
/// <remarks>Formats the resolved string with <paramref name="arguments"/>.</remarks>
protected string T(string key, params object[] arguments) =>
Services.IdentityText(key, arguments);
}
public abstract class IdentityLocalizedComponentBase : LocalizedComponentBase<IdentityStrings>;

This file was deleted.

6 changes: 3 additions & 3 deletions src/AndreGoepel.Marten.Identity.Blazor/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"net10.0": {
"AndreGoepel.Design.Blazor": {
"type": "Direct",
"requested": "[1.4.2, )",
"resolved": "1.4.2",
"contentHash": "57laKLfocolPOcRbBLP0GccM9k3T+grGAnlv/BpUmH9n1SnbxAqq6YEotTq5E9xThMq9WvuSGv/VUTB1B6Bdww==",
"requested": "[1.6.0, )",
"resolved": "1.6.0",
"contentHash": "ciJLnfD2c8mXk/WMPlybrwEhWnpsA8IGTrNAzo+5mRLAy0k7MQFWNPrTOlW536BYAhb0Ri3INseVBQfV8fX8ww==",
"dependencies": {
"Radzen.Blazor": "11.1.7"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@
"andregoepel.marten.identity.blazor": {
"type": "Project",
"dependencies": {
"AndreGoepel.Design.Blazor": "[1.4.2, )",
"AndreGoepel.Design.Blazor": "[1.6.0, )",
"AndreGoepel.Marten.Configuration": "[1.0.1, )",
"AndreGoepel.Marten.Identity": "[1.8.0, )",
"Marten": "[9.19.0, )",
Expand All @@ -399,9 +399,9 @@
},
"AndreGoepel.Design.Blazor": {
"type": "CentralTransitive",
"requested": "[1.4.2, )",
"resolved": "1.4.2",
"contentHash": "57laKLfocolPOcRbBLP0GccM9k3T+grGAnlv/BpUmH9n1SnbxAqq6YEotTq5E9xThMq9WvuSGv/VUTB1B6Bdww==",
"requested": "[1.6.0, )",
"resolved": "1.6.0",
"contentHash": "ciJLnfD2c8mXk/WMPlybrwEhWnpsA8IGTrNAzo+5mRLAy0k7MQFWNPrTOlW536BYAhb0Ri3INseVBQfV8fX8ww==",
"dependencies": {
"Radzen.Blazor": "11.1.7"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
"andregoepel.marten.identity.blazor": {
"type": "Project",
"dependencies": {
"AndreGoepel.Design.Blazor": "[1.4.2, )",
"AndreGoepel.Design.Blazor": "[1.6.0, )",
"AndreGoepel.Marten.Configuration": "[1.0.1, )",
"AndreGoepel.Marten.Identity": "[1.8.0, )",
"Marten": "[9.19.0, )",
Expand All @@ -446,9 +446,9 @@
},
"AndreGoepel.Design.Blazor": {
"type": "CentralTransitive",
"requested": "[1.4.2, )",
"resolved": "1.4.2",
"contentHash": "57laKLfocolPOcRbBLP0GccM9k3T+grGAnlv/BpUmH9n1SnbxAqq6YEotTq5E9xThMq9WvuSGv/VUTB1B6Bdww==",
"requested": "[1.6.0, )",
"resolved": "1.6.0",
"contentHash": "ciJLnfD2c8mXk/WMPlybrwEhWnpsA8IGTrNAzo+5mRLAy0k7MQFWNPrTOlW536BYAhb0Ri3INseVBQfV8fX8ww==",
"dependencies": {
"Radzen.Blazor": "11.1.7"
}
Expand Down