Skip to content

Commit 8f6926f

Browse files
committed
Upgrade .NET version and add a Blazor.Web.App Sample
1 parent 18a97a9 commit 8f6926f

69 files changed

Lines changed: 60542 additions & 305 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/AKSoftware.Localization.MultiLanguages.Blazor/AKSoftware.Localization.MultiLanguages.Blazor.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
55
<Authors>Ahmad Mozaffar</Authors>
66
<Company>AK Software</Company>
77
<Description>AKSoftware.Localization.MultiLanguages is a .NET library that allows .NET developers to build applications that targets multiple languages very easy just with few lines of code, Blazor extensions helps the library to track the status of the components and update them whenever the SetLanguage function being called</Description>
@@ -17,7 +17,7 @@
1717
<AssemblyVersion>6.0.0</AssemblyVersion>
1818
<FileVersion>6.0.0.0</FileVersion>
1919
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
20-
<Version>6.0.0-alpha</Version>
20+
<Version>6.0.0</Version>
2121
</PropertyGroup>
2222

2323
<ItemGroup>

src/AKSoftware.Localization.MultiLanguages.SourceGenerator/AKSoftware.Localization.MultiLanguages.SourceGenerator.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
<PackageProjectUrl>https://akmultilanguages.azurewebsites.net</PackageProjectUrl>
1919
<RepositoryUrl>https://github.com/aksoftware98/multilanguages</RepositoryUrl>
2020
<PackageIcon>AkMultiLanguages.png</PackageIcon>
21-
<AssemblyVersion>6.0.0</AssemblyVersion>
22-
<FileVersion>6.0.0</FileVersion>
21+
<AssemblyVersion>6.0.1</AssemblyVersion>
22+
<FileVersion>6.0.1</FileVersion>
2323
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
24-
<Version>6.0.0-alpha</Version>
24+
<Version>6.0.1</Version>
2525
<PackageReadmeFile>README.md</PackageReadmeFile>
2626
</PropertyGroup>
2727

src/AKSoftware.Localization.MultiLanguages.sln

Lines changed: 318 additions & 295 deletions
Large diffs are not rendered by default.

src/AKSoftware.Localization.MultiLanguages/AKSoftware.Localization.MultiLanguages.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFrameworks>netstandard2.0;net8.0;net9.0</TargetFrameworks>
55
<Company>AK Software</Company>
66
<Authors>Ahmad Mozaffar</Authors>
77
<Description>AKSoftware.Localization.MultiLanguages is a .NET library that allows .NET developers to build applications that targets multiple languages very easy just with few lines of code</Description>
@@ -14,10 +14,10 @@
1414
<PackageProjectUrl>https://akmultilanguages.azurewebsites.net</PackageProjectUrl>
1515
<RepositoryUrl>https://github.com/aksoftware98/multilanguages</RepositoryUrl>
1616
<PackageIcon>AkMultiLanguages.png</PackageIcon>
17-
<AssemblyVersion>6.0.0</AssemblyVersion>
18-
<FileVersion>6.0.0</FileVersion>
17+
<AssemblyVersion>6.0.1</AssemblyVersion>
18+
<FileVersion>6.0.1</FileVersion>
1919
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
20-
<Version>6.0.0-alpha</Version>
20+
<Version>6.0.1</Version>
2121
<PackageReadmeFile>README.md</PackageReadmeFile>
2222
</PropertyGroup>
2323

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net9.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<AdditionalFiles Remove="resources\es-ES.yml" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<None Remove="Resources\es-ES.yml" />
15+
</ItemGroup>
16+
17+
<ItemGroup>
18+
<PackageReference Include="AKSoftware.Localization.MultiLanguages.Blazor" Version="6.0.0-alpha" />
19+
<PackageReference Include="AKSoftware.Localization.MultiLanguages.SourceGenerator" Version="6.0.0-alpha" />
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<base href="/" />
8+
<link rel="stylesheet" href="@Assets["lib/bootstrap/dist/css/bootstrap.min.css"]" />
9+
<link rel="stylesheet" href="@Assets["app.css"]" />
10+
<link rel="stylesheet" href="@Assets["BlazorWebApp.Sample.styles.css"]" />
11+
<ImportMap />
12+
<link rel="icon" type="image/png" href="favicon.png" />
13+
<HeadOutlet />
14+
</head>
15+
16+
<body>
17+
<Routes />
18+
<script src="_framework/blazor.web.js"></script>
19+
</body>
20+
21+
</html>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu />
6+
</div>
7+
8+
<main>
9+
<div class="top-row px-4">
10+
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
11+
</div>
12+
13+
<article class="content px-4">
14+
@Body
15+
</article>
16+
</main>
17+
</div>
18+
19+
<div id="blazor-error-ui" data-nosnippet>
20+
An unhandled error has occurred.
21+
<a href="." class="reload">Reload</a>
22+
<span class="dismiss">🗙</span>
23+
</div>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
.page {
2+
position: relative;
3+
display: flex;
4+
flex-direction: column;
5+
}
6+
7+
main {
8+
flex: 1;
9+
}
10+
11+
.sidebar {
12+
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
13+
}
14+
15+
.top-row {
16+
background-color: #f7f7f7;
17+
border-bottom: 1px solid #d6d5d5;
18+
justify-content: flex-end;
19+
height: 3.5rem;
20+
display: flex;
21+
align-items: center;
22+
}
23+
24+
.top-row ::deep a, .top-row ::deep .btn-link {
25+
white-space: nowrap;
26+
margin-left: 1.5rem;
27+
text-decoration: none;
28+
}
29+
30+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
32+
}
33+
34+
.top-row ::deep a:first-child {
35+
overflow: hidden;
36+
text-overflow: ellipsis;
37+
}
38+
39+
@media (max-width: 640.98px) {
40+
.top-row {
41+
justify-content: space-between;
42+
}
43+
44+
.top-row ::deep a, .top-row ::deep .btn-link {
45+
margin-left: 0;
46+
}
47+
}
48+
49+
@media (min-width: 641px) {
50+
.page {
51+
flex-direction: row;
52+
}
53+
54+
.sidebar {
55+
width: 250px;
56+
height: 100vh;
57+
position: sticky;
58+
top: 0;
59+
}
60+
61+
.top-row {
62+
position: sticky;
63+
top: 0;
64+
z-index: 1;
65+
}
66+
67+
.top-row.auth ::deep a:first-child {
68+
flex: 1;
69+
text-align: right;
70+
width: 0;
71+
}
72+
73+
.top-row, article {
74+
padding-left: 2rem !important;
75+
padding-right: 1.5rem !important;
76+
}
77+
}
78+
79+
#blazor-error-ui {
80+
color-scheme: light only;
81+
background: lightyellow;
82+
bottom: 0;
83+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
84+
box-sizing: border-box;
85+
display: none;
86+
left: 0;
87+
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
88+
position: fixed;
89+
width: 100%;
90+
z-index: 1000;
91+
}
92+
93+
#blazor-error-ui .dismiss {
94+
cursor: pointer;
95+
position: absolute;
96+
right: 0.75rem;
97+
top: 0.5rem;
98+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@using System.Globalization
2+
@inject IKeysAccessor Keys
3+
@inject ILanguageContainerService Language
4+
@rendermode InteractiveServer
5+
6+
<div class="top-row ps-3 navbar navbar-dark">
7+
<div class="container-fluid">
8+
<a class="navbar-brand" href="">BlazorWebApp.Sample</a>
9+
</div>
10+
</div>
11+
12+
<input type="checkbox" title="Navigation menu" class="navbar-toggler" />
13+
14+
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
15+
<nav class="nav flex-column">
16+
<div class="nav-item px-3">
17+
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
18+
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> @Keys.Home
19+
</NavLink>
20+
</div>
21+
22+
<div class="nav-item px-3">
23+
<NavLink class="nav-link" href="counter">
24+
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> @Keys.Counter
25+
</NavLink>
26+
</div>
27+
28+
<div class="nav-item px-3">
29+
<NavLink class="nav-link" href="weather">
30+
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> @Keys.Weather
31+
</NavLink>
32+
</div>
33+
34+
<div class="nav-item px-3">
35+
<NavLink class="nav-link" @onclick="SwitchLanguage">
36+
<span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Switch to @_otherLanguage
37+
</NavLink>
38+
</div>
39+
<div class="nav-item px-3">
40+
<button class="btn btn-primary" @onclick="SwitchLanguage">Switch to @_otherLanguage</button>
41+
</div>
42+
</nav>
43+
</div>
44+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using AKSoftware.Localization.MultiLanguages.Blazor;
2+
using System.Globalization;
3+
4+
namespace BlazorWebApp.Sample.Components.Layout
5+
{
6+
public partial class NavMenu
7+
{
8+
9+
protected override void OnInitialized()
10+
{
11+
Language.InitLocalizedComponent(this);
12+
}
13+
14+
private string _currentLanguage = "en-US";
15+
private string _otherLanguage => _currentLanguage == "en-US" ? "Spanish" : "English";
16+
17+
private void SwitchLanguage()
18+
{
19+
_currentLanguage = _currentLanguage == "en-US" ? "es-ES" : "en-US";
20+
CultureInfo cultureInfo = new CultureInfo(_currentLanguage);
21+
Language.SetLanguage(cultureInfo);
22+
StateHasChanged();
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)