-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some Basic Localization functionality.
Added Language Selector Added Some NavMenu translations Fixed issue on Brands and Producsts where View and Delete option was showing in edit screen duplicated. Added Header conformity to Login,SelfRegister and ForgotPassword
- Loading branch information
Showing
57 changed files
with
4,458 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FSH.Starter.Shared.Constants; | ||
|
||
public class LanguageCode | ||
{ | ||
public string DisplayName { get; set; } | ||
Check warning on line 5 in src/Shared/Constants/LanguageCode.cs GitHub Actions / build
|
||
public string Code { get; set; } | ||
Check warning on line 6 in src/Shared/Constants/LanguageCode.cs GitHub Actions / build
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace FSH.Starter.Shared.Constants; | ||
|
||
public static class LocalizationConstants | ||
{ | ||
public static readonly LanguageCode[] SupportedLanguages = { | ||
new LanguageCode | ||
{ | ||
Code = "en-US", | ||
DisplayName= "English" | ||
}, | ||
new LanguageCode | ||
{ | ||
Code = "af-ZA", | ||
DisplayName = "Afrikaans" | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
src/apps/blazor/client/Components/Dialogs/DeleteConfirmation.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,5 @@ | |
</MudButton> | ||
} | ||
</DialogActions> | ||
|
||
</MudDialog> | ||
</EditForm> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/apps/blazor/client/Components/Localization/LanguageSelector.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@using FSH.Starter.Shared.Constants | ||
@using FSH.Starter.Blazor.Infrastructure.Preferences; | ||
@inject Microsoft.Extensions.Localization.IStringLocalizer<LanguageSelector> L | ||
<MudTooltip Text="@CurrentLanguage"> | ||
<MudMenu Icon="@Icons.Material.Outlined.Translate" Color="Color.Inherit" Direction="Direction.Bottom" OffsetY="true" | ||
Dense="true"> | ||
@foreach (var language in LocalizationConstants.SupportedLanguages) | ||
{ | ||
if (language.Code == CurrentLanguage) | ||
{ | ||
<MudMenuItem style="background:var(--mud-palette-primary); color:white">@L[language.DisplayName]</MudMenuItem> | ||
} | ||
else | ||
{ | ||
<MudMenuItem OnClick="(()=> ChangeLanguageAsync(language.Code))">@L[language.DisplayName]</MudMenuItem> | ||
} | ||
} | ||
</MudMenu> | ||
</MudTooltip> | ||
|
||
@code { | ||
public string? CurrentLanguage { get; set; } = "en-US"; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
var currentPreference = await ClientPreferences.GetPreference() as ClientPreference; | ||
if (currentPreference != null) | ||
{ | ||
CurrentLanguage = currentPreference.LanguageCode; | ||
} | ||
else | ||
{ | ||
CurrentLanguage = "en-US"; | ||
} | ||
|
||
} | ||
private async Task ChangeLanguageAsync(string languageCode) | ||
{ | ||
var result = await ClientPreferences.ChangeLanguageAsync(languageCode); | ||
Navigation.NavigateTo(Navigation.Uri, forceLoad: true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,38 @@ | ||
@page "/forgot-password" | ||
@attribute [AllowAnonymous] | ||
@inject Microsoft.Extensions.Localization.IStringLocalizer<ForgotPassword> _localizer | ||
|
||
<PageTitle>Forgot Password</PageTitle> | ||
<PageHeader Title="@_localizer["Title"]" Header="@_localizer["Header"]" SubHeader="@_localizer["SubHeader"]" /> | ||
|
||
<EditForm Model="@_forgotPasswordRequest" OnValidSubmit="SubmitAsync"> | ||
<MudCard Elevation="0"> | ||
<MudCardHeader> | ||
<CardHeaderContent> | ||
<MudTooltip Text="Go Back"> | ||
<MudTooltip Text="@_localizer["GoBack"]"> | ||
<MudIconButton Icon="@Icons.Material.Filled.ArrowBack" Color="Color.Inherit" Edge="Edge.Start" | ||
Href="/" /> | ||
</MudTooltip> | ||
<div class="fsh-center-text" style="padding-top: 20px;"> | ||
<MudText Typo="Typo.h4" GutterBottom="true" style="margin-bottom:5px">Forgot Password? | ||
</MudText> | ||
<MudText>We can help you by resetting your password.</MudText> | ||
</div> | ||
</CardHeaderContent> | ||
</MudCardHeader> | ||
<MudCardContent> | ||
<MudGrid> | ||
<DataAnnotationsValidator /> | ||
<FshValidation @ref="_customValidation" /> | ||
<MudItem xs="12"> | ||
<MudTextField T="string" Label="Tenant" Variant="Variant.Outlined" @bind-Value="Tenant" | ||
<MudTextField T="string" Label="@_localizer["Tenant"]" Variant="Variant.Outlined" @bind-Value="Tenant" | ||
For="@(() => Tenant)" Required /> | ||
</MudItem> | ||
<MudItem xs="12"> | ||
<MudTextField T="string" Label="E-mail" Variant="Variant.Outlined" | ||
<MudTextField T="string" Label="@_localizer["Email"]" Variant="Variant.Outlined" | ||
@bind-Value="_forgotPasswordRequest.Email" For="@(() => _forgotPasswordRequest.Email)" | ||
InputType="InputType.Email" Adornment="Adornment.End" /> | ||
</MudItem> | ||
</MudGrid> | ||
</MudCardContent> | ||
<MudCardActions Class="pb-4 pl-4"> | ||
<MudButton DropShadow="false" Variant="Variant.Filled" Color="Color.Primary" StartIcon="@Icons.Material.Filled.LockReset" ButtonType="ButtonType.Submit" Disabled="BusySubmitting" Class="ml-auto"> | ||
Forgot Password</MudButton> | ||
@_localizer["ForgotPassword"] | ||
</MudButton> | ||
</MudCardActions> | ||
</MudCard> | ||
</EditForm> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,39 @@ | ||
@page "/login" | ||
@attribute [AllowAnonymous] | ||
@inject IAuthenticationService authService | ||
@inject Microsoft.Extensions.Localization.IStringLocalizer<Login> _localizer | ||
|
||
<PageTitle>Login</PageTitle> | ||
<PageHeader Title="@_localizer["Title"]" Header="@_localizer["Header"]" SubHeader="@_localizer["SubHeader"]" /> | ||
|
||
<div class="fsh-center-text"> | ||
<MudText Typo="Typo.h4" GutterBottom="true">Sign In</MudText> | ||
<MudText> | ||
Enter your credentials to get started. | ||
</MudText> | ||
</div> | ||
<br /> | ||
<EditForm Model="@_tokenRequest" OnValidSubmit="SubmitAsync"> | ||
<MudGrid> | ||
<DataAnnotationsValidator /> | ||
<FshValidation @ref="_customValidation" /> | ||
<MudItem xs="12"> | ||
<MudTextField T="string" Label="E-mail" Variant="Variant.Outlined" @bind-Value="_tokenRequest.Email" | ||
<MudTextField T="string" Label="@_localizer["Email"]" Variant="Variant.Outlined" @bind-Value="_tokenRequest.Email" | ||
For="@(() => _tokenRequest.Email)" /> | ||
</MudItem> | ||
<MudItem xs="12"> | ||
<MudTextField Label="Password" Variant="Variant.Outlined" @bind-Value="_tokenRequest.Password" | ||
<MudTextField Label="@_localizer["Password"]" Variant="Variant.Outlined" @bind-Value="_tokenRequest.Password" | ||
For="@(() => _tokenRequest.Password)" InputType="@_passwordInput" Adornment="Adornment.End" | ||
AdornmentIcon="@_passwordInputIcon" OnAdornmentClick="TogglePasswordVisibility" /> | ||
</MudItem> | ||
<MudItem xs="12"> | ||
<MudTextField T="string" Label="Tenant" Variant="Variant.Outlined" @bind-Value="TenantId" | ||
<MudTextField T="string" Label="@_localizer["Tenant"]" Variant="Variant.Outlined" @bind-Value="TenantId" | ||
For="@(() => TenantId)" Required /> | ||
</MudItem> | ||
|
||
<MudItem xs="12" md="6"> | ||
<MudButton StartIcon="@Icons.Material.Filled.AppRegistration" Href="/register">Register?</MudButton> | ||
<MudButton StartIcon="@Icons.Material.Filled.AppRegistration" Href="/register">@_localizer["Register?"]</MudButton> | ||
</MudItem> | ||
<MudItem xs="12" md="6"> | ||
<MudButton StartIcon="@Icons.Material.Filled.LockReset" Href="/forgot-password">Forgot password?</MudButton> | ||
<MudButton StartIcon="@Icons.Material.Filled.LockReset" Href="/forgot-password">@_localizer["Forgot password?"]</MudButton> | ||
</MudItem> | ||
<MudItem xs="12" Class="d-flex justify-center"> | ||
<MudButton ButtonType="ButtonType.Submit" Disabled="BusySubmitting" Variant="Variant.Filled" | ||
Color="Color.Primary" DropShadow="false" Size="Size.Large" StartIcon="@Icons.Material.Filled.Login" Style="width: 100%;">Sign In</MudButton> | ||
Color="Color.Primary" DropShadow="false" Size="Size.Large" StartIcon="@Icons.Material.Filled.Login" Style="width: 100%;">@_localizer["Sign In"]</MudButton> | ||
</MudItem> | ||
<MudItem xs="12" Class="d-flex justify-center"> | ||
<MudButton DropShadow="false" StartIcon="@Icons.Material.Filled.Password" OnClick="FillAdministratorCredentials">Fill Administrator Credentials</MudButton> | ||
<MudButton DropShadow="false" StartIcon="@Icons.Material.Filled.Password" OnClick="FillAdministratorCredentials">@_localizer["Fill Administrator Credentials"]</MudButton> | ||
</MudItem> | ||
</MudGrid> | ||
</EditForm> |
Oops, something went wrong.