-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from BharatRamsf3693/master
documentation(85914): Need to correct the invalid currency symbol issue in our Localization samples and then provide localization samples for Maui Blazor app.
- Loading branch information
Showing
114 changed files
with
85,653 additions
and
24 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
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
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
26 changes: 26 additions & 0 deletions
26
.NET8 MAUI Blazor App/Localization-with-dynamic-culture/App.xaml
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,26 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="clr-namespace:LocalizationMauiBlazor" | ||
x:Class="LocalizationMauiBlazor.App"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
|
||
<Color x:Key="PageBackgroundColor">#512bdf</Color> | ||
<Color x:Key="PrimaryTextColor">White</Color> | ||
|
||
<Style TargetType="Label"> | ||
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" /> | ||
<Setter Property="FontFamily" Value="OpenSansRegular" /> | ||
</Style> | ||
|
||
<Style TargetType="Button"> | ||
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" /> | ||
<Setter Property="FontFamily" Value="OpenSansRegular" /> | ||
<Setter Property="BackgroundColor" Value="#2b0b98" /> | ||
<Setter Property="Padding" Value="14,10" /> | ||
</Style> | ||
|
||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
17 changes: 17 additions & 0 deletions
17
.NET8 MAUI Blazor App/Localization-with-dynamic-culture/App.xaml.cs
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 @@ | ||
using System.Globalization; | ||
|
||
namespace LocalizationMauiBlazor | ||
{ | ||
public partial class App : Application | ||
{ | ||
public App() | ||
{ | ||
InitializeComponent(); | ||
var language = Preferences.Get("language", "en-US"); | ||
var culture = new CultureInfo(language); | ||
CultureInfo.DefaultThreadCurrentCulture = culture; | ||
CultureInfo.DefaultThreadCurrentUICulture = culture; | ||
MainPage = new MainPage(); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...MAUI Blazor App/Localization-with-dynamic-culture/Components/Layout/CultureSwitcher.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,35 @@ | ||
@using System.Globalization | ||
@inject NavigationManager NavigationManager | ||
|
||
<select @bind="Culture"> | ||
@foreach (var culture in supportedCultures) | ||
{ | ||
<option value="@culture">@culture.DisplayName</option> | ||
} | ||
</select> | ||
|
||
@code { | ||
private CultureInfo[] supportedCultures = new[] | ||
{ | ||
new CultureInfo("en-US"), | ||
new CultureInfo("de-DE"), | ||
new CultureInfo("fr-FR"), | ||
new CultureInfo("ar-AE"), | ||
new CultureInfo("zh-HK") | ||
}; | ||
|
||
private CultureInfo Culture | ||
{ | ||
get => CultureInfo.CurrentCulture; | ||
set | ||
{ | ||
if (CultureInfo.CurrentCulture != value) | ||
{ | ||
CultureInfo.DefaultThreadCurrentCulture = value; | ||
CultureInfo.DefaultThreadCurrentUICulture = value; | ||
Preferences.Set("language", value.Name); | ||
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true); | ||
} | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Components/Layout/MainLayout.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,18 @@ | ||
@inherits LayoutComponentBase | ||
|
||
<div class="page"> | ||
<div class="sidebar"> | ||
<NavMenu /> | ||
</div> | ||
|
||
<main> | ||
<div class="top-row px-4"> | ||
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a> | ||
</div> | ||
|
||
<article class="content px-4"> | ||
<CultureSwitcher /> | ||
@Body | ||
</article> | ||
</main> | ||
</div> |
77 changes: 77 additions & 0 deletions
77
... MAUI Blazor App/Localization-with-dynamic-culture/Components/Layout/MainLayout.razor.css
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,77 @@ | ||
.page { | ||
position: relative; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
main { | ||
flex: 1; | ||
} | ||
|
||
.sidebar { | ||
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); | ||
} | ||
|
||
.top-row { | ||
background-color: #f7f7f7; | ||
border-bottom: 1px solid #d6d5d5; | ||
justify-content: flex-end; | ||
height: 3.5rem; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.top-row ::deep a, .top-row ::deep .btn-link { | ||
white-space: nowrap; | ||
margin-left: 1.5rem; | ||
text-decoration: none; | ||
} | ||
|
||
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
.top-row ::deep a:first-child { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
@media (max-width: 640.98px) { | ||
.top-row { | ||
justify-content: space-between; | ||
} | ||
|
||
.top-row ::deep a, .top-row ::deep .btn-link { | ||
margin-left: 0; | ||
} | ||
} | ||
|
||
@media (min-width: 641px) { | ||
.page { | ||
flex-direction: row; | ||
} | ||
|
||
.sidebar { | ||
width: 250px; | ||
height: 100vh; | ||
position: sticky; | ||
top: 0; | ||
} | ||
|
||
.top-row { | ||
position: sticky; | ||
top: 0; | ||
z-index: 1; | ||
} | ||
|
||
.top-row.auth ::deep a:first-child { | ||
flex: 1; | ||
text-align: right; | ||
width: 0; | ||
} | ||
|
||
.top-row, article { | ||
padding-left: 2rem !important; | ||
padding-right: 1.5rem !important; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
.NET8 MAUI Blazor App/Localization-with-dynamic-culture/Components/Layout/NavMenu.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,27 @@ | ||
<div class="top-row ps-3 navbar navbar-dark"> | ||
<div class="container-fluid"> | ||
<a class="navbar-brand" href="">LocalizationMauiBlazor</a> | ||
</div> | ||
</div> | ||
|
||
<input type="checkbox" title="Navigation menu" class="navbar-toggler" /> | ||
|
||
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()"> | ||
<nav class="flex-column"> | ||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> | ||
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home | ||
</NavLink> | ||
</div> | ||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="counter"> | ||
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Counter | ||
</NavLink> | ||
</div> | ||
<div class="nav-item px-3"> | ||
<NavLink class="nav-link" href="weather"> | ||
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Weather | ||
</NavLink> | ||
</div> | ||
</nav> | ||
</div> |
Oops, something went wrong.