I'm trying to apply localization on _Layout.cshtml
_Layout.cshtml
@using Microsoft.AspNetCore.Http.Extensions
@using Microsoft.AspNetCore.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
@inject IViewLocalizer LayoutLocalizer
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div style="margin:38px;margin-top:56px;" class="hidden-sm-down">
<h2>@LayoutLocalizer["WelcomeHeader"] <b class="text_border_darkblue">MyTitle</b></h2>
<div style="text-align:center;margin-top:42px;">
@LayoutLocalizer["WelcomeSub"]
</div>
</div>
</body>
</html>
The resource files are named named: Views.Shared._Layout.no.resx (I've tried renaming to views.shared.Layout.no.resx without any luck)
App localization involves the following: Make the app's content localizable. Provide localized resources for the languages and cultures you support. Implement a strategy to select the language/culture for each request.
Localization is the process of customizing the globalized web application to a specific locale and culture. Various resources such as images and text for the specific locale are created. The resource file in localization is scoped to a particular page in an application.
You must create a _Layout.no.resx file within the same path of the views but as a root the "Resources" folder. See sample image:
There is a video clarifying the use of Location see here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With