Skip to content

Commit 49f08c1

Browse files
committed
Add all translations in resource files, per module, shared and Blazor by Namespace
1 parent 973867b commit 49f08c1

86 files changed

Lines changed: 3411 additions & 1176 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/BuildingBlocks/Blazor.UI/Blazor.UI.csproj

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,25 @@
77
<!-- MUD0002: MudBlazor analyzer false positives for valid component parameter usage in RenderFragment/component contexts -->
88
<NoWarn>$(NoWarn);MUD0002;NU1507</NoWarn>
99

10-
<!-- Enable CSS isolation for Razor Class Library -->
11-
<GenerateScopedCssFiles>true</GenerateScopedCssFiles>
10+
<!-- Disable CSS isolation to prevent unused preload warnings -->
11+
<!-- Components can still use regular CSS files -->
12+
<GenerateScopedCssFiles>false</GenerateScopedCssFiles>
1213
</PropertyGroup>
1314

1415

1516
<ItemGroup>
1617
<SupportedPlatform Include="browser" />
1718
</ItemGroup>
1819

19-
<ItemGroup>
20-
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" />
21-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />
22-
<PackageReference Include="MudBlazor" />
23-
<PackageReference Include="MudBlazor.ThemeManager" />
24-
</ItemGroup>
20+
<ItemGroup>
21+
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" />
22+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />
23+
<PackageReference Include="MudBlazor" />
24+
<PackageReference Include="MudBlazor.ThemeManager" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<ProjectReference Include="..\Shared\Shared.csproj" />
29+
</ItemGroup>
2530

2631
</Project>
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using Microsoft.AspNetCore.Components;
1+
using FSH.Framework.Shared.Localization;
2+
using Microsoft.AspNetCore.Components;
3+
using Microsoft.Extensions.Localization;
24

35
namespace FSH.Framework.Blazor.UI.Components.Base;
46

@@ -7,4 +9,5 @@ public abstract class FshComponentBase : ComponentBase
79
[Inject] protected ISnackbar Snackbar { get; set; } = default!;
810
[Inject] protected IDialogService DialogService { get; set; } = default!;
911
[Inject] protected NavigationManager Navigation { get; set; } = default!;
12+
[Inject] protected IStringLocalizer<SharedResource> L { get; set; } = default!;
1013
}

src/BuildingBlocks/Blazor.UI/Components/Common/FshAccountMenu.razor

Whitespace-only changes.

src/BuildingBlocks/Blazor.UI/Components/Dialogs/FshDialogService.cs

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
using Microsoft.AspNetCore.Components;
2-
using MudBlazor;
1+
using FSH.Framework.Shared.Localization;
2+
using Microsoft.Extensions.Localization;
3+
using System.Globalization;
34

45
namespace FSH.Framework.Blazor.UI.Components.Dialogs;
56

@@ -45,25 +46,40 @@ public static async Task<bool> ShowConfirmAsync(
4546

4647
public static Task<bool> ShowDeleteConfirmAsync(
4748
this IDialogService dialogService,
48-
string itemName = "this item")
49+
string itemName,
50+
IStringLocalizer<SharedResource>? localizer = null)
4951
{
52+
string title = localizer?["DeleteConfirmation"] ?? "Delete Confirmation";
53+
string message = localizer != null
54+
? string.Format(CultureInfo.InvariantCulture, localizer["ConfirmDelete"], itemName)
55+
: $"Are you sure you want to delete {itemName}? This action cannot be undone.";
56+
string confirmText = localizer?["Delete"] ?? "Delete";
57+
string cancelText = localizer?["Cancel"] ?? "Cancel";
58+
5059
return dialogService.ShowConfirmAsync(
51-
title: "Delete Confirmation",
52-
message: $"Are you sure you want to delete {itemName}? This action cannot be undone.",
53-
confirmText: "Delete",
54-
cancelText: "Cancel",
60+
title: title,
61+
message: message,
62+
confirmText: confirmText,
63+
cancelText: cancelText,
5564
confirmColor: Color.Error,
5665
icon: Icons.Material.Outlined.DeleteForever,
5766
iconColor: Color.Error);
5867
}
5968

60-
public static Task<bool> ShowSignOutConfirmAsync(this IDialogService dialogService)
69+
public static Task<bool> ShowSignOutConfirmAsync(
70+
this IDialogService dialogService,
71+
IStringLocalizer<SharedResource>? localizer = null)
6172
{
73+
string title = localizer?["SignOut"] ?? "Sign Out";
74+
string message = localizer?["ConfirmSignOut"] ?? "Are you sure you want to sign out of your account?";
75+
string confirmText = localizer?["SignOut"] ?? "Sign Out";
76+
string cancelText = localizer?["Cancel"] ?? "Cancel";
77+
6278
return dialogService.ShowConfirmAsync(
63-
title: "Sign Out",
64-
message: "Are you sure you want to sign out of your account?",
65-
confirmText: "Sign Out",
66-
cancelText: "Cancel",
79+
title: title,
80+
message: message,
81+
confirmText: confirmText,
82+
cancelText: cancelText,
6783
confirmColor: Color.Error,
6884
icon: Icons.Material.Outlined.Logout,
6985
iconColor: Color.Warning);

src/BuildingBlocks/Blazor.UI/Components/Theme/FshBrandAssetsPicker.razor

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
@using FSH.Framework.Blazor.UI.Theme
2+
@using FSH.Framework.Shared.Localization
3+
@using Microsoft.Extensions.Localization
4+
@inject IStringLocalizer<SharedResource> L
25

36
<MudPaper Class="pa-4" Elevation="0" Outlined="true">
4-
<MudText Typo="Typo.h6" Class="mb-4">Brand Assets</MudText>
7+
<MudText Typo="Typo.h6" Class="mb-4">@L["BrandAssets"]</MudText>
58

69
<MudGrid>
710
@* Light Mode Logo *@
811
<MudItem xs="12" sm="6" md="4">
912
<MudPaper Class="pa-4" Elevation="0" Outlined="true">
10-
<MudText Typo="Typo.subtitle2" Class="mb-2">Logo (Light Mode)</MudText>
13+
<MudText Typo="Typo.subtitle2" Class="mb-2">@L["LogoLightMode"]</MudText>
1114
@if (!string.IsNullOrEmpty(BrandAssets.LogoUrl))
1215
{
1316
<div class="d-flex flex-column align-center gap-2">
@@ -21,7 +24,7 @@
2124
Size="Size.Small"
2225
StartIcon="@Icons.Material.Filled.Delete"
2326
OnClick="@(() => ClearLogo())">
24-
Remove
27+
@L["Remove"]
2528
</MudButton>
2629
</div>
2730
}
@@ -37,7 +40,7 @@
3740
Elevation="0"
3841
@onclick="@(async (e) => await upload.OpenFilePickerAsync())">
3942
<MudIcon Icon="@Icons.Material.Outlined.CloudUpload" Size="Size.Large" Color="Color.Default" />
40-
<MudText Typo="Typo.caption" Class="mt-2">Click to upload logo</MudText>
43+
<MudText Typo="Typo.caption" Class="mt-2">@L["ClickToUpload"]</MudText>
4144
<MudText Typo="Typo.caption" Color="Color.Secondary">PNG, JPG, SVG, WebP</MudText>
4245
</MudPaper>
4346
</CustomContent>
@@ -49,7 +52,7 @@
4952
@* Dark Mode Logo *@
5053
<MudItem xs="12" sm="6" md="4">
5154
<MudPaper Class="pa-4" Elevation="0" Outlined="true" Style="background-color: #1a1a2e;">
52-
<MudText Typo="Typo.subtitle2" Class="mb-2" Style="color: white;">Logo (Dark Mode)</MudText>
55+
<MudText Typo="Typo.subtitle2" Class="mb-2" Style="color: white;">@L["LogoDarkMode"]</MudText>
5356
@if (!string.IsNullOrEmpty(BrandAssets.LogoDarkUrl))
5457
{
5558
<div class="d-flex flex-column align-center gap-2">
@@ -63,7 +66,7 @@
6366
Size="Size.Small"
6467
StartIcon="@Icons.Material.Filled.Delete"
6568
OnClick="@(() => ClearLogoDark())">
66-
Remove
69+
@L["Remove"]
6770
</MudButton>
6871
</div>
6972
}
@@ -79,7 +82,7 @@
7982
Elevation="0"
8083
@onclick="@(async (e) => await upload.OpenFilePickerAsync())">
8184
<MudIcon Icon="@Icons.Material.Outlined.CloudUpload" Size="Size.Large" Style="color: rgba(255,255,255,0.7);" />
82-
<MudText Typo="Typo.caption" Class="mt-2" Style="color: rgba(255,255,255,0.7);">Click to upload logo</MudText>
85+
<MudText Typo="Typo.caption" Class="mt-2" Style="color: rgba(255,255,255,0.7);">@L["ClickToUpload"]</MudText>
8386
<MudText Typo="Typo.caption" Style="color: rgba(255,255,255,0.5);">PNG, JPG, SVG, WebP</MudText>
8487
</MudPaper>
8588
</CustomContent>
@@ -91,7 +94,7 @@
9194
@* Favicon *@
9295
<MudItem xs="12" sm="6" md="4">
9396
<MudPaper Class="pa-4" Elevation="0" Outlined="true">
94-
<MudText Typo="Typo.subtitle2" Class="mb-2">Favicon</MudText>
97+
<MudText Typo="Typo.subtitle2" Class="mb-2">@L["Favicon"]</MudText>
9598
@if (!string.IsNullOrEmpty(BrandAssets.FaviconUrl))
9699
{
97100
<div class="d-flex flex-column align-center gap-2">
@@ -106,7 +109,7 @@
106109
Size="Size.Small"
107110
StartIcon="@Icons.Material.Filled.Delete"
108111
OnClick="@(() => ClearFavicon())">
109-
Remove
112+
@L["Remove"]
110113
</MudButton>
111114
</div>
112115
}
@@ -122,7 +125,7 @@
122125
Elevation="0"
123126
@onclick="@(async (e) => await upload.OpenFilePickerAsync())">
124127
<MudIcon Icon="@Icons.Material.Outlined.Image" Size="Size.Large" Color="Color.Default" />
125-
<MudText Typo="Typo.caption" Class="mt-2">Click to upload favicon</MudText>
128+
<MudText Typo="Typo.caption" Class="mt-2">@L["ClickToUpload"]</MudText>
126129
<MudText Typo="Typo.caption" Color="Color.Secondary">16x16 or 32x32 PNG, ICO</MudText>
127130
</MudPaper>
128131
</CustomContent>

src/BuildingBlocks/Blazor.UI/Components/Theme/FshColorPalettePicker.razor

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
@using FSH.Framework.Blazor.UI.Theme
2+
@using FSH.Framework.Shared.Localization
3+
@using Microsoft.Extensions.Localization
24
@using MudBlazor.Utilities
5+
@inject IStringLocalizer<SharedResource> L
36

47
<MudPaper Class="pa-4" Elevation="0" Outlined="true">
58
<MudText Typo="Typo.h6" Class="mb-4">@Title</MudText>
69

710
<MudGrid>
811
<MudItem xs="12" sm="6" md="4">
9-
<MudText Typo="Typo.caption" Class="mb-1">Primary</MudText>
12+
<MudText Typo="Typo.caption" Class="mb-1">@L["Primary"]</MudText>
1013
<MudColorPicker Value="@GetColor(Palette.Primary)"
1114
ValueChanged="@(c => OnColorChanged(c, v => Palette.Primary = v))"
12-
Label="Primary"
15+
Label="@L["Primary"]"
1316
DisableAlpha="true"
1417
DisableModeSwitch="true"
1518
ColorPickerMode="ColorPickerMode.HEX"
@@ -20,10 +23,10 @@
2023
</MudItem>
2124

2225
<MudItem xs="12" sm="6" md="4">
23-
<MudText Typo="Typo.caption" Class="mb-1">Secondary</MudText>
26+
<MudText Typo="Typo.caption" Class="mb-1">@L["Secondary"]</MudText>
2427
<MudColorPicker Value="@GetColor(Palette.Secondary)"
2528
ValueChanged="@(c => OnColorChanged(c, v => Palette.Secondary = v))"
26-
Label="Secondary"
29+
Label="@L["Secondary"]"
2730
DisableAlpha="true"
2831
DisableModeSwitch="true"
2932
ColorPickerMode="ColorPickerMode.HEX"
@@ -33,10 +36,10 @@
3336
</MudItem>
3437

3538
<MudItem xs="12" sm="6" md="4">
36-
<MudText Typo="Typo.caption" Class="mb-1">Tertiary</MudText>
39+
<MudText Typo="Typo.caption" Class="mb-1">@L["Tertiary"]</MudText>
3740
<MudColorPicker Value="@GetColor(Palette.Tertiary)"
3841
ValueChanged="@(c => OnColorChanged(c, v => Palette.Tertiary = v))"
39-
Label="Tertiary"
42+
Label="@L["Tertiary"]"
4043
DisableAlpha="true"
4144
DisableModeSwitch="true"
4245
ColorPickerMode="ColorPickerMode.HEX"
@@ -46,10 +49,10 @@
4649
</MudItem>
4750

4851
<MudItem xs="12" sm="6" md="4">
49-
<MudText Typo="Typo.caption" Class="mb-1">Background</MudText>
52+
<MudText Typo="Typo.caption" Class="mb-1">@L["Background"]</MudText>
5053
<MudColorPicker Value="@GetColor(Palette.Background)"
5154
ValueChanged="@(c => OnColorChanged(c, v => Palette.Background = v))"
52-
Label="Background"
55+
Label="@L["Background"]"
5356
DisableAlpha="true"
5457
DisableModeSwitch="true"
5558
ColorPickerMode="ColorPickerMode.HEX"
@@ -59,10 +62,10 @@
5962
</MudItem>
6063

6164
<MudItem xs="12" sm="6" md="4">
62-
<MudText Typo="Typo.caption" Class="mb-1">Surface</MudText>
65+
<MudText Typo="Typo.caption" Class="mb-1">@L["Surface"]</MudText>
6366
<MudColorPicker Value="@GetColor(Palette.Surface)"
6467
ValueChanged="@(c => OnColorChanged(c, v => Palette.Surface = v))"
65-
Label="Surface"
68+
Label="@L["Surface"]"
6669
DisableAlpha="true"
6770
DisableModeSwitch="true"
6871
ColorPickerMode="ColorPickerMode.HEX"
@@ -72,14 +75,14 @@
7275
</MudItem>
7376

7477
<MudItem xs="12" Class="mt-4">
75-
<MudText Typo="Typo.subtitle2" Class="mb-2">Semantic Colors</MudText>
78+
<MudText Typo="Typo.subtitle2" Class="mb-2">@L["SemanticColors"]</MudText>
7679
</MudItem>
7780

7881
<MudItem xs="12" sm="6" md="3">
79-
<MudText Typo="Typo.caption" Class="mb-1">Success</MudText>
82+
<MudText Typo="Typo.caption" Class="mb-1">@L["Success"]</MudText>
8083
<MudColorPicker Value="@GetColor(Palette.Success)"
8184
ValueChanged="@(c => OnColorChanged(c, v => Palette.Success = v))"
82-
Label="Success"
85+
Label="@L["Success"]"
8386
DisableAlpha="true"
8487
DisableModeSwitch="true"
8588
ColorPickerMode="ColorPickerMode.HEX"
@@ -89,10 +92,10 @@
8992
</MudItem>
9093

9194
<MudItem xs="12" sm="6" md="3">
92-
<MudText Typo="Typo.caption" Class="mb-1">Info</MudText>
95+
<MudText Typo="Typo.caption" Class="mb-1">@L["Info"]</MudText>
9396
<MudColorPicker Value="@GetColor(Palette.Info)"
9497
ValueChanged="@(c => OnColorChanged(c, v => Palette.Info = v))"
95-
Label="Info"
98+
Label="@L["Info"]"
9699
DisableAlpha="true"
97100
DisableModeSwitch="true"
98101
ColorPickerMode="ColorPickerMode.HEX"
@@ -102,10 +105,10 @@
102105
</MudItem>
103106

104107
<MudItem xs="12" sm="6" md="3">
105-
<MudText Typo="Typo.caption" Class="mb-1">Warning</MudText>
108+
<MudText Typo="Typo.caption" Class="mb-1">@L["Warning"]</MudText>
106109
<MudColorPicker Value="@GetColor(Palette.Warning)"
107110
ValueChanged="@(c => OnColorChanged(c, v => Palette.Warning = v))"
108-
Label="Warning"
111+
Label="@L["Warning"]"
109112
DisableAlpha="true"
110113
DisableModeSwitch="true"
111114
ColorPickerMode="ColorPickerMode.HEX"
@@ -115,10 +118,10 @@
115118
</MudItem>
116119

117120
<MudItem xs="12" sm="6" md="3">
118-
<MudText Typo="Typo.caption" Class="mb-1">Error</MudText>
121+
<MudText Typo="Typo.caption" Class="mb-1">@L["Error"]</MudText>
119122
<MudColorPicker Value="@GetColor(Palette.Error)"
120123
ValueChanged="@(c => OnColorChanged(c, v => Palette.Error = v))"
121-
Label="Error"
124+
Label="@L["Error"]"
122125
DisableAlpha="true"
123126
DisableModeSwitch="true"
124127
ColorPickerMode="ColorPickerMode.HEX"

src/BuildingBlocks/Blazor.UI/Components/Theme/FshLayoutPicker.razor

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
@using FSH.Framework.Blazor.UI.Theme
2+
@using FSH.Framework.Shared.Localization
3+
@using Microsoft.Extensions.Localization
4+
@inject IStringLocalizer<SharedResource> L
25

36
<MudPaper Class="pa-4" Elevation="0" Outlined="true">
4-
<MudText Typo="Typo.h6" Class="mb-4">Layout Settings</MudText>
7+
<MudText Typo="Typo.h6" Class="mb-4">@L["LayoutSettings"]</MudText>
58

69
<MudGrid>
710
<MudItem xs="12" sm="6">
811
<MudSelect T="string"
9-
Label="Border Radius"
12+
Label="@L["BorderRadius"]"
1013
Value="@Layout.BorderRadius"
1114
ValueChanged="@OnBorderRadiusChanged"
1215
Variant="Variant.Outlined"
@@ -27,29 +30,29 @@
2730
Max="24"
2831
Step="1"
2932
Color="Color.Primary">
30-
<MudText Typo="Typo.caption">Default Elevation: @Layout.DefaultElevation</MudText>
33+
<MudText Typo="Typo.caption">@L["DefaultElevation"]: @Layout.DefaultElevation</MudText>
3134
</MudSlider>
3235
</MudItem>
3336
</MudGrid>
3437

3538
<MudDivider Class="my-4" />
3639

37-
<MudText Typo="Typo.subtitle2" Class="mb-2">Preview</MudText>
40+
<MudText Typo="Typo.subtitle2" Class="mb-2">@L["Preview"]</MudText>
3841
<div class="d-flex gap-4 flex-wrap">
3942
<MudPaper Class="pa-4"
4043
Elevation="@Layout.DefaultElevation"
4144
Style="@GetCardStyle()">
42-
<MudText Typo="Typo.body1">Card with elevation @Layout.DefaultElevation</MudText>
45+
<MudText Typo="Typo.body1">@L["Preview"] @Layout.DefaultElevation</MudText>
4346
</MudPaper>
4447

4548
<MudButton Variant="Variant.Filled"
4649
Color="Color.Primary"
4750
Style="@GetButtonStyle()">
48-
Button Preview
51+
@L["Preview"]
4952
</MudButton>
5053

5154
<MudTextField T="string"
52-
Label="Input Preview"
55+
Label="@L["Preview"]"
5356
Variant="Variant.Outlined"
5457
Style="@GetInputStyle()" />
5558
</div>

0 commit comments

Comments
 (0)