Skip to content

Commit d5d45d8

Browse files
Merge pull request #17864 from dotnet/master
Merge to Live on 1x April
2 parents 77c0463 + ad99987 commit d5d45d8

50 files changed

Lines changed: 40259 additions & 257 deletions

Some content is hidden

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

aspnetcore/blazor/globalization-localization.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ The following field types have specific formatting requirements and aren't curre
5454

5555
### Blazor WebAssembly
5656

57-
By default, Blazor's linker configuration for Blazor WebAssembly apps strips out internationalization information except for locales explicitly requested. For more information and guidance on controlling the linker's behavior, see <xref:host-and-deploy/blazor/configure-linker#configure-the-linker-for-internationalization>.
58-
59-
<!-- HOLD FOR 3.2 PREVIEW 4: Replace prior paragraph with ...
60-
6157
Blazor WebAssembly apps set the culture using the user's [language preference](https://developer.mozilla.org/docs/Web/API/NavigatorLanguage/languages).
6258

6359
To explicitly configure the culture, set `CultureInfo.DefaultThreadCurrentCulture` and `CultureInfo.DefaultThreadCurrentUICulture` in `Program.Main`.
@@ -66,8 +62,6 @@ By default, Blazor's linker configuration for Blazor WebAssembly apps strips out
6662

6763
While the culture that Blazor selects by default might be sufficient for most users, consider offering a way for users to specify their preferred locale. For a Blazor WebAssembly sample app with a culture picker, see the [LocSample](https://github.com/pranavkm/LocSample) localization sample app.
6864

69-
-->
70-
7165
### Blazor Server
7266

7367
Blazor Server apps are localized using [Localization Middleware](xref:fundamentals/localization#localization-middleware). The middleware selects the appropriate culture for users requesting resources from the app.

aspnetcore/fundamentals/environments.md

Lines changed: 105 additions & 249 deletions
Large diffs are not rendered by default.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Use IntelliSense to learn about possible attributes.
2+
// Hover to view descriptions of existing attributes.
3+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
4+
{
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (web)",
9+
"type": "coreclr",
10+
// Configuration ommitted for brevity.
11+
"request": "launch",
12+
"preLaunchTask": "build",
13+
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/EnvironmentsSample.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}",
16+
"stopAtEntry": false,
17+
"internalConsoleOptions": "openOnSessionStart",
18+
"launchBrowser": {
19+
"enabled": true,
20+
"args": "${auto-detect-url}",
21+
"windows": {
22+
"command": "cmd.exe",
23+
"args": "/C start ${auto-detect-url}"
24+
},
25+
"osx": {
26+
"command": "open"
27+
},
28+
"linux": {
29+
"command": "xdg-open"
30+
}
31+
},
32+
"env": {
33+
"ASPNETCORE_ENVIRONMENT": "Development",
34+
"ASPNETCORE_URLS": "https://localhost:5001",
35+
"ASPNETCORE_DETAILEDERRORS": "1",
36+
"ASPNETCORE_SHUTDOWNTIMEOUTSECONDS": "3"
37+
},
38+
// Configuration ommitted for brevity.
39+
"sourceFileMap": {
40+
"/Views": "${workspaceFolder}/Views"
41+
}
42+
},
43+
{
44+
"name": ".NET Core Attach",
45+
"type": "coreclr",
46+
"request": "attach",
47+
"processId": "${command:pickProcess}"
48+
}
49+
]
50+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "build",
8+
"type": "shell",
9+
"command": "dotnet",
10+
"args": [
11+
"build",
12+
"${workspaceFolder}/EnvironmentsSample.csproj"
13+
],
14+
"group": "build",
15+
"presentation": {
16+
// Reveal the output only if unrecognized errors occur.
17+
"reveal": "silent"
18+
},
19+
// Use the standard MS compiler pattern to detect errors, warnings and infos
20+
"problemMatcher": "$msCompile"
21+
}
22+
]
23+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<Configurations>Debug;Release;IISxMultiConfig</Configurations>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='IISxMultiConfig|AnyCPU'">
9+
<DefineConstants>TRACE;MULTI</DefineConstants>
10+
</PropertyGroup>
11+
12+
13+
14+
</Project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@page
2+
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnv
3+
@model AboutModel
4+
@{
5+
ViewData["Title"] = "About";
6+
}
7+
<h2>@ViewData["Title"]</h2>
8+
<h3>@Model.Message</h3>
9+
10+
<p> ASPNETCORE_ENVIRONMENT = @hostingEnv.EnvironmentName</p>
11+
12+
<environment include="Development">
13+
<div>The effective tag is: &lt;environment include="Development"&gt;</div>
14+
</environment>
15+
<environment exclude="Development">
16+
<div>The effective tag is: &lt;environment exclude="Development"&gt;</div>
17+
</environment>
18+
<environment include="Staging,Development,Staging_2">
19+
<div>
20+
The effective tag is:
21+
&lt;environment include="Staging,Development,Staging_2"&gt;
22+
</div>
23+
</environment>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.AspNetCore.Mvc.RazorPages;
2+
using System;
3+
4+
namespace EnvironmentsSample.Pages
5+
{
6+
public class AboutModel : PageModel
7+
{
8+
public string Message { get; set; }
9+
10+
public void OnGet()
11+
{
12+
var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
13+
Message = $"ASPNETCORE_ENVIRONMENT = {env}";
14+
}
15+
}
16+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@page
2+
@model ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
26+
</p>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Mvc;
7+
using Microsoft.AspNetCore.Mvc.RazorPages;
8+
using Microsoft.Extensions.Logging;
9+
10+
namespace EnvironmentsSample.Pages
11+
{
12+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
13+
public class ErrorModel : PageModel
14+
{
15+
public string RequestId { get; set; }
16+
17+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
18+
19+
private readonly ILogger<ErrorModel> _logger;
20+
21+
public ErrorModel(ILogger<ErrorModel> logger)
22+
{
23+
_logger = logger;
24+
}
25+
26+
public void OnGet()
27+
{
28+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
29+
}
30+
}
31+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@page
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home page";
5+
}
6+
7+
<div class="text-center">
8+
<h1 class="display-4">Welcome</h1>
9+
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
10+
</div>

0 commit comments

Comments
 (0)