Added appropriate startup services and configs.
Some checks failed
RealYHD/props/pipeline/head There was a failure building this commit
ydeng/props/pipeline/head There was a failure building this commit

Added example files for reference on how to perform localization.
This commit is contained in:
Harrison Deng 2022-04-25 11:58:33 -05:00
parent 8801bea801
commit d3a0b35811
3 changed files with 32 additions and 3 deletions

View File

@ -5,7 +5,6 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<PublishTrimmed>false</PublishTrimmed> <PublishTrimmed>false</PublishTrimmed>
<PublishReadyToRun>true</PublishReadyToRun> <PublishReadyToRun>true</PublishReadyToRun>
<!-- <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> --> <!-- <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract> -->

View File

@ -7,7 +7,6 @@ using Microsoft.Extensions.Hosting;
using Props.Data; using Props.Data;
using Props.Models.User; using Props.Models.User;
using Props.Services.Modules; using Props.Services.Modules;
using System;
namespace Props namespace Props
{ {
@ -44,7 +43,16 @@ namespace Props
} }
services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true) services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<ApplicationDbContext>(); .AddEntityFrameworkStores<ApplicationDbContext>();
services.AddRazorPages();
services.AddLocalization(options =>
{
options.ResourcesPath = "locales";
});
services.AddRazorPages().AddViewLocalization(options =>
{
options.ResourcesPath = "locales";
}).AddDataAnnotationsLocalization();
services.AddSingleton<IShopManager, ModularShopManager>(); services.AddSingleton<IShopManager, ModularShopManager>();
services.AddScoped<IMetricsManager, LiveMetricsManager>(); services.AddScoped<IMetricsManager, LiveMetricsManager>();
@ -61,8 +69,14 @@ namespace Props
app.UseMigrationsEndPoint(); app.UseMigrationsEndPoint();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseStaticFiles(); app.UseStaticFiles();
app.UseRequestLocalization(options =>
{
options.SetDefaultCulture("en-US");
});
app.UseRouting(); app.UseRouting();
app.UseAuthentication(); app.UseAuthentication();

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<data name="description" xml:space="preserve">
<value>Props is a community driven website meant to help with organizing your online component shopping experience. Create project component lists, search across multiple commonly used online retail stores and share your projects with rest of the community!</value>
</data>
<data name="help.title" xml:space="preserve">
<value>Getting Started</value>
</data>
<data name="help.searchIntroduction" xml:space="preserve">
<value>Props is a site designed to help with the online project component shopping experience. Create project component lists and search across multiple commonly used online retail stores to find the ideal purchase.</value>
</data>
<!-- single line comment -->
<!-- multi
line
comment -->
</root>