Skip to content

Commit 4fc1345

Browse files
author
Casparus J Van Zyl
committed
Expand on Loclaizations.
Oustanding with Admin Permissions razor
1 parent e8636b3 commit 4fc1345

Some content is hidden

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

44 files changed

+3143
-602
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
<MudTablePager RowsPerPageString="RowsPerPageString" InfoFormat="InfoFormat" />
1+
@inject Microsoft.Extensions.Localization.IStringLocalizer<TablePager> _localizer
2+
<MudTablePager RowsPerPageString="@_localizer["RowsPerPageString"]" InfoFormat="@_localizer["InfoFormat"]" />

src/apps/blazor/client/Components/EntityTable/AddEditModal.razor

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@typeparam TRequest
1+
@inject Microsoft.Extensions.Localization.IStringLocalizer<Modals> _localizer
2+
@typeparam TRequest
23

34
<EditForm Model="@RequestModel" OnValidSubmit="SaveAsync">
45
<MudDialog>
@@ -29,18 +30,18 @@
2930

3031
<DialogActions>
3132
<MudButton DropShadow="false" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Cancel" OnClick="MudDialog.Cancel">
32-
Cancel
33+
@_localizer["Cancel"]
3334
</MudButton>
3435
@if (IsCreate)
3536
{
3637
<MudButton DropShadow="false" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Save" ButtonType="ButtonType.Submit" Color="Color.Success">
37-
Save
38+
@_localizer["Save"]
3839
</MudButton>
3940
}
4041
else
4142
{
4243
<MudButton DropShadow="false" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Update" ButtonType="ButtonType.Submit" Color="Color.Secondary">
43-
Update
44+
@_localizer["Update"]
4445
</MudButton>
4546
}
4647
</DialogActions>

src/apps/blazor/client/Components/EntityTable/EntityTable.razor

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
@typeparam TEntity
1+
@inject Microsoft.Extensions.Localization.IStringLocalizer<Modals> _localizer
2+
@typeparam TEntity
23
@typeparam TId
34
@typeparam TRequest
4-
55
@inject IJSRuntime JS
6-
76
<style>
87
.mud-table-container {
98
overflow: auto;
@@ -16,7 +15,7 @@
1615
{
1716
<MudExpansionPanel @bind-bind-Expanded="_advancedSearchExpanded"
1817
Style="padding:10px!important; margin-bottom:10px!important;border-radius: var(--mud-default-borderradius) !important;"
19-
Class="mud-table mud-table-outlined" Text="Advanced Search" Expanded=false>
18+
Class="mud-table mud-table-outlined" Text="@_localizer["Advanced Search"]" Expanded=false>
2019
<MudTextField @bind-Value="SearchString" Immediate="true"
2120
Placeholder="@($"Search for {Context.EntityNamePlural}")" Adornment="Adornment.Start"
2221
AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium"
@@ -45,10 +44,10 @@
4544
{
4645
<MudButton Variant="Variant.Filled" Color="Color.Primary" DropShadow="false"
4746
OnClick="(() => InvokeModal())" StartIcon="@Icons.Material.Filled.Add"
48-
IconColor="Color.Surface" Class="mr-4">Create</MudButton>
47+
IconColor="Color.Surface" Class="mr-4">@_localizer["Create"]</MudButton>
4948
}
5049
<MudButton Variant="Variant.Filled" OnClick="ReloadDataAsync" DropShadow="false"
51-
StartIcon="@Icons.Material.Filled.Refresh" IconColor="Color.Surface" Color="Color.Secondary">Reload</MudButton>
50+
StartIcon="@Icons.Material.Filled.Refresh" IconColor="Color.Surface" Color="Color.Secondary">@_localizer["Reload"]</MudButton>
5251
</div>
5352
<MudSpacer />
5453
@if (_canSearch && !_advancedSearchExpanded)
@@ -78,7 +77,7 @@
7877
</MudTh>
7978
}
8079
}
81-
<MudTh Style="text-align:right">Actions</MudTh>
80+
<MudTh Style="text-align:right">@_localizer["Actions"]</MudTh>
8281
</HeaderContent>
8382

8483
<RowTemplate>
@@ -106,16 +105,16 @@
106105
}
107106
else if (HasActions)
108107
{
109-
<MudMenu Label="Actions" Variant="Variant.Filled" DropShadow=false
108+
<MudMenu Label="@_localizer["Actions"]" Variant="Variant.Filled" DropShadow=false
110109
EndIcon="@Icons.Material.Filled.KeyboardArrowDown" IconColor="Color.Secondary" direction="Direction.Left"
111110
offsetX="true">
112111
@if (CanUpdateEntity(context))
113112
{
114-
<MudMenuItem @onclick="@(() => InvokeModal(context))">Edit</MudMenuItem>
113+
<MudMenuItem @onclick="@(() => InvokeModal(context))">@_localizer["Edit"]</MudMenuItem>
115114
}
116115
@if (CanDeleteEntity(context))
117116
{
118-
<MudMenuItem Style="color:red!important" @onclick="@(() => Delete(context))">Delete</MudMenuItem>
117+
<MudMenuItem Style="color:red!important" @onclick="@(() => Delete(context))">@_localizer["Delete"]</MudMenuItem>
119118
}
120119
@if (ExtraActions is not null)
121120
{
@@ -128,7 +127,7 @@
128127
<MudButton Variant="Variant.Filled" DropShadow="false"
129128
StartIcon="@Icons.Material.Filled.DoNotTouch" IconColor="Color.Secondary" Size="Size.Small"
130129
Color="Color.Surface">
131-
No Allowed Actions
130+
@_localizer["No Allowed Actions"]
132131
</MudButton>
133132
}
134133
</MudTd>

src/apps/blazor/client/Components/EntityTable/EntityTable.razor.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ Context.GetDefaultsFunc is not null
218218
? defaultsResult
219219
: new TRequest();
220220

221-
title = $"Create {Context.EntityName}";
222-
successMessage = $"{Context.EntityName} Created";
221+
title = $"{_localizer["Create"]} {Context.EntityName}";
222+
successMessage = $"{Context.EntityName} {_localizer["Created"]}";
223223
}
224224
else
225225
{
@@ -239,8 +239,8 @@ Context.GetDetailsFunc is not null
239239
? detailsResult
240240
: entity!.Adapt<TRequest>();
241241

242-
title = $"Edit {Context.EntityName}";
243-
successMessage = $"{Context.EntityName}Updated";
242+
title = $"{_localizer["Update"]} {Context.EntityName}";
243+
successMessage = $"{Context.EntityName} {_localizer["Updated"]}";
244244
}
245245

246246
parameters.Add(nameof(AddEditModal<TRequest>.SaveFunc), saveFunc);
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<h3>Modals</h3>
2+
3+
@code {
4+
5+
}

src/apps/blazor/client/Pages/Identity/Account/Account.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
@page "/identity/account"
22
@inject Microsoft.Extensions.Localization.IStringLocalizer<Account> _localizer
3-
<PageHeader Title="Account" Header="Account" SubHeader="Manage your Account." />
3+
<PageHeader Title="@_localizer["Account"]" Header="@_localizer["Account"]" SubHeader="@_localizer["Manage your Account."]" />
44

55
<MudTabs Outlined Color="Color.Transparent" Rounded="true" PanelClass="mt-6">
6-
<MudTabPanel Text="Profile">
6+
<MudTabPanel Text="@_localizer["Profile"]">
77
<Profile />
88
</MudTabPanel>
99
@if (!SecurityTabHidden)
1010
{
11-
<MudTabPanel Text="Security">
11+
<MudTabPanel Text="@_localizer["Security"]">
1212
<Security />
1313
</MudTabPanel>
1414
}
Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
@page "/identity/roles"
22
@inject Microsoft.Extensions.Localization.IStringLocalizer<Roles> _localizer
3-
<PageHeader Title="Roles" Header="Roles" SubHeader="Manage Roles." />
3+
<PageHeader Title="@_localizer["Roles"]" Header="@_localizer["Roles"]" SubHeader="@_localizer["Manage Roles."]" />
44

55
<EntityTable TEntity="RoleDto" TId="string" TRequest="CreateOrUpdateRoleCommand" Context="@Context">
66
<ExtraActions>
77
@if (_canViewRoleClaims)
88
{
9-
<MudMenuItem @onclick="@(() => ManagePermissions(context.Id))">Manage Permission</MudMenuItem>
9+
<MudMenuItem @onclick="@(() => ManagePermissions(context.Id))">@_localizer["Manage Permission"]</MudMenuItem>
1010
}
1111
</ExtraActions>
1212
<EditFormContent>
1313
@if (!Context.AddEditModal.IsCreate)
1414
{
1515
<MudItem xs="12" md="6">
16-
<MudTextField Value="context.Id" ReadOnly Underline="false" Label="Id]" />
16+
<MudTextField Value="context.Id" ReadOnly Underline="false" Label="@_localizer["Id"]" />
1717
</MudItem>
1818
}
1919
<MudItem xs="12" md="6">
20-
<MudTextField For="@(() => context.Name)" @bind-Value="context.Name" Label="Name" />
20+
<MudTextField For="@(() => context.Name)" @bind-Value="context.Name" Label="@_localizer["Name"]" />
2121
</MudItem>
2222
<MudItem xs="12" md="6">
23-
<MudTextField For="@(() => context.Description)" @bind-Value="context.Description"
24-
Label="Description" />
23+
<MudTextField For="@(() => context.Description)" @bind-Value="context.Description" Label="@_localizer["Description"]" />
2524
</MudItem>
2625
</EditFormContent>
2726

28-
</EntityTable>
27+
</EntityTable>
28+
29+

src/apps/blazor/client/Pages/Identity/Roles/Roles.razor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ protected override async Task OnInitializedAsync()
2727
_canViewRoleClaims = await AuthService.HasPermissionAsync(state.User, FshActions.View, FshResources.RoleClaims);
2828

2929
Context = new(
30-
entityName: "Role",
31-
entityNamePlural: "Roles",
30+
entityName: _localizer["Role"],
31+
entityNamePlural: _localizer["Roles"],
3232
entityResource: FshResources.Roles,
3333
searchAction: FshActions.View,
3434
fields: new()
3535
{
36-
new(role => role.Id, "Id"),
37-
new(role => role.Name,"Name"),
38-
new(role => role.Description, "Description")
36+
new(role => role.Id, _localizer["Id"], "Id"),
37+
new(role => role.Name,_localizer["Name"], "Name"),
38+
new(role => role.Description, _localizer["Description"], "Description")
3939
},
4040
idFunc: role => role.Id,
4141
loadDataFunc: async () => (await RolesClient.GetRolesEndpointAsync()).ToList(),

src/apps/blazor/client/Pages/Identity/Users/Audit.razor

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
@page "/identity/audit-trail"
33
@inject Microsoft.Extensions.Localization.IStringLocalizer<Audit> _localizer
44

5-
<PageHeader Title="Audit Trail" Header="Audit Trail" SubHeader="@_subHeader" />
5+
<PageHeader Title="@_localizer["Audit Trail"]" Header="@_localizer["Audit Trail"]" SubHeader="@_subHeader" />
66

77
<EntityTable TEntity="RelatedAuditTrail" TId="Guid" TRequest="object" Context="@Context">
88

99
<ActionsContent>
1010
<MudButton Variant="Variant.Filled" DropShadow="false" EndIcon="@Icons.Material.Filled.KeyboardArrowDown" IconColor="Color.Secondary"
11-
OnClick="@(() => ShowBtnPress(context.Id))">@((context.ShowDetails == true) ? "Hide" : "Show") Trail Details</MudButton>
11+
OnClick="@(() => ShowBtnPress(context.Id))">@((context.ShowDetails == true) ? _localizer["Hide"] : _localizer["Show"]) @_localizer["Trail Details"]</MudButton>
1212
</ActionsContent>
1313

1414
<ChildRowContent>
@@ -19,7 +19,7 @@
1919
<MudCard Outlined style="margin: 10px !important;">
2020
<MudCardHeader>
2121
<CardHeaderContent>
22-
<MudAlert Severity="Severity.Success" Typo="Typo.body1">Details for Audit Trail with Id : <strong>@context.Id</strong></MudAlert>
22+
<MudAlert Severity="Severity.Success" Typo="Typo.body1">@_localizer["Details for Audit Trail with Id :"] <strong>@context.Id</strong></MudAlert>
2323
</CardHeaderContent>
2424
</MudCardHeader>
2525
<MudCardContent>
@@ -28,7 +28,7 @@
2828
@if (!string.IsNullOrEmpty(context.ModifiedProperties))
2929
{
3030
<tr class="mud-table-row" style="padding:10px!important">
31-
<td>Modified Properties</td>
31+
<td>@_localizer["Modified Properties"]</td>
3232
<td>
3333
<MudItem>
3434
@foreach (var column in context.ModifiedProperties.Trim('[').Trim(']').Split(','))
@@ -42,7 +42,7 @@
4242
@if (!string.IsNullOrEmpty(context.PrimaryKey))
4343
{
4444
<tr class="mud-table-row">
45-
<td>Primary Key</td>
45+
<td>@_localizer["Primary Key"]</td>
4646
<td>
4747
<MudItem>
4848
<MudChip T=string Label="true" Color="Color.Surface">@context.PrimaryKey?.Trim('{').Trim('}').Replace('"', ' ').Trim()</MudChip>
@@ -53,7 +53,7 @@
5353
@if (!string.IsNullOrEmpty(context.PreviousValues))
5454
{
5555
<tr class="mud-table-row">
56-
<td>Previous Values</td>
56+
<td>@_localizer["Previous Values"]</td>
5757
<td>
5858

5959
<MudItem>
@@ -77,7 +77,7 @@
7777
@if (!string.IsNullOrEmpty(context.NewValues))
7878
{
7979
<tr class="mud-table-row">
80-
<td>Current Values</td>
80+
<td>@_localizer["Current Values"]</td>
8181
<td>
8282
8383
<MudItem>

src/apps/blazor/client/Pages/Identity/Users/UserProfile.razor

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,17 @@ else
1616
<MudCard Outlined>
1717
<MudCardHeader>
1818
<CardHeaderContent>
19-
<MudText Typo="Typo.body1">Administrator Settings.</MudText>
20-
<MudText Typo="Typo.body2">This is an Administrator Only View.</MudText>
19+
<MudText Typo="Typo.body1">@_localizer["Administrator Settings."]</MudText>
20+
<MudText Typo="Typo.body2">@_localizer["This is an Administrator Only View."]</MudText>
2121
</CardHeaderContent>
2222
</MudCardHeader>
2323
<MudCardContent Class="pa-46" Style="padding:26px!important">
2424
<MudGrid Style="padding-left:14px">
25-
<MudSwitch T="bool" @bind-Value="@_active" Color="Color.Primary" Label="Active?"></MudSwitch>
26-
<MudSwitch T="bool" ReadOnly @bind-Value="@_emailConfirmed" Disabled Label="Email Confirmed?" Color="Color.Secondary"></MudSwitch>
25+
<MudSwitch T="bool" @bind-Value="@_active" Color="Color.Primary" Label="@_localizer["Active?"]"></MudSwitch>
26+
<MudSwitch T="bool" ReadOnly @bind-Value="@_emailConfirmed" Disabled Label="@_localizer["Email Confirmed?"]" Color="Color.Secondary"></MudSwitch>
2727
<MudButton Variant="Variant.Filled" Color="Color.Primary" Class="ml-auto"
28-
OnClick="ToggleUserStatus" ButtonType="ButtonType.Submit">Save Changes
28+
OnClick="ToggleUserStatus" ButtonType="ButtonType.Submit">
29+
@_localizer["Save Changes"]
2930
</MudButton>
3031
</MudGrid>
3132
</MudCardContent>
@@ -59,7 +60,7 @@ else
5960
<MudButton HtmlTag="label" DropShadow="false" Variant="Variant.Filled" Color="Color.Info"
6061
Size="Size.Small" Target="_blank" StartIcon="@Icons.Material.Filled.RemoveRedEye" Href="@_imageUrl.ToString()"
6162
Style="margin-left: 5px;">
62-
View
63+
@_localizer["View"]
6364
</MudButton>
6465
}
6566
</div>
@@ -71,23 +72,22 @@ else
7172
<MudCard Outlined>
7273
<MudCardHeader>
7374
<CardHeaderContent>
74-
<MudText>Public Profile</MudText>
75+
<MudText>@_localizer["Public Profile"]</MudText>
7576
</CardHeaderContent>
7677
</MudCardHeader>
7778
<MudCardContent>
7879
<MudGrid>
7980
<MudItem xs="12" md="6">
80-
<MudField Label="First Name" Variant="Variant.Outlined">@_firstName</MudField>
81+
<MudField Label="@_localizer["First Name"]" Variant="Variant.Outlined">@_firstName</MudField>
8182
</MudItem>
8283
<MudItem xs="12" md="6">
83-
<MudField Label="Last Name" Variant="Variant.Outlined">@_lastName</MudField>
84+
<MudField Label="@_localizer["Last Name"]" Variant="Variant.Outlined">@_lastName</MudField>
8485
</MudItem>
8586
<MudItem xs="12" md="6">
86-
<MudField Label="Phone Number" Variant="Variant.Outlined">@_phoneNumber
87-
</MudField>
87+
<MudField Label="@_localizer["PhoneNumber"]" Variant="Variant.Outlined">@_phoneNumber</MudField>
8888
</MudItem>
8989
<MudItem xs="12" md="6">
90-
<MudField Label="Email" Variant="Variant.Outlined">@_email</MudField>
90+
<MudField Label="@_localizer["Email"]" Variant="Variant.Outlined">@_email</MudField>
9191
</MudItem>
9292
</MudGrid>
9393
</MudCardContent>

0 commit comments

Comments
 (0)