Questions tagged [asp.net-core-localization]

ASP.NET Core Localization is the set of abstractions and implementations that allow developers to adapt their ASP.NET Core applications to a particular language, culture, and desired local "look and feel".

See Also

130 questions
2
votes
2 answers

How to use localization with String.Format

I work on an Asp.net Core MVC website with localization and I've a text to display with variables inside like : @{var item = "car"}

Max's @item is blue

but in french it's @{var item = "la voiture"}

@item de Max est bleue

So the…
2
votes
1 answer

Localization in .NET Core 2 Web API

I've followed this guide for getting my localization to work with my validation. But either I've done something wrong, or it isn't supported. I have a Controller: [HttpPost] public IActionResult Post([FromBody]Customer value) { if…
smoksnes
  • 9,330
  • 3
  • 41
  • 57
2
votes
2 answers

CustomRequestCultureProvider: context.User.Identity.IsAuthenticated is always false

I'm trying to implement a CustomRequestCultureProvider in my localization pipeline, to retrieve the user culture from the database. To identify the user, I need the ClaimsPrincipal, but for some reason, even though the user is authenticated,…
2
votes
3 answers

How to get localized string from ASP.NET Core Controller using IStringLocalizer?

Kinda confused here, super simple hello-world example of localization in ASP.Net Core 2.0. My About page is set up to render two localized strings: From the view (using IViewLocalizer) From code (using IStringLocalizer via the…
2
votes
1 answer

How to create a SharedResource class for localization with default localization

In ConfigureServices I did: services.AddLocalization(opts => opts.ResourcesPath = "Resources"); services.AddMvc(options => { options.MaxModelValidationErrors = 10; }) .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix, opts…
Eugene
  • 287
  • 4
  • 16
2
votes
1 answer

ASP NET CORE 2.0 localized views

I have an asp net core 2.0 app. There's some views with static data that i have to translate according to culture. I'm going to create multiple views like someview-en.chtml, someview-fr.chtml etc. Is it possible to return view according to request…
N1gthm4r3
  • 645
  • 1
  • 8
  • 22
2
votes
1 answer

Overwrite .Net Core "CultureInfo" after login

My application is working well with new cultures! So far so good! But... I want overwrite the actual "CultureInfo" after the user is logged in. I have to do this because i need to reset the "CultureInfo.DateTimeFormat" with other one saved in my DB.…
2
votes
2 answers

How to pass the resource language to a different page

I need to pass the globalization resource language which is selected from the first page to the next page. Please follow the images and code segments and tell me whats wrong with it. 1) I'm getting the language from the drop down using below…
Harsha W
  • 2,473
  • 2
  • 31
  • 53
2
votes
1 answer

Read route values in asp.net core 1.0.0

I want to implement a nice way of localization and need help to figure out how to readout route parameters. First of all i implemented the Localization as follows: In Startup.cs // Configure supported cultures and localization…
1
vote
1 answer

Localization doesn't work on production - .NET core 3.1

I'm using localization for my API application. The problem is, everything work well on local machine, but when I deployed the application on Azure, localization doesn't work anymore. Here is the result when requesting on debugging (the message is…
Quyết
  • 38
  • 1
  • 7
1
vote
2 answers

Handling exceptions during localizing in .net5

I would like to ask you if it is possible to handle exception during localizing? For instance I have made recently mistake in my resx file, and my localizer caused that in one language users got error (in translated version I wrote something like…
1
vote
1 answer

Force localization be in specific language in specific controller

I have a web-api project that has several controllers, I implemented localization (English and Korean) for it but want one or two controllers return messages in English even when the language is Korean (don't want use simple English message and want…
SajjadZare
  • 2,262
  • 4
  • 34
  • 61
1
vote
1 answer

.NET MVC Core 3.1 Localization UrlHelper doesn't take the current culture

I'm converting a .Net 4.7 application to .Net Core 3.1. I am updating the localization part. I followed some examples like localization-in-asp-net-core-3-1-mvc. It works fine but I didn't find a way to make the UrlHelper.Action working without…
1
vote
1 answer

.Net Core Razor has wrong culture

I have a localized .Net Core 3 app. My resources are in a separate assembly in .resx files. The localization is set up to use cookies like this: var cultureProvider = new CookieRequestCultureProvider(); cultureProvider.CookieName =…
Stas
  • 69
  • 9
1
vote
1 answer

.Net Core 3.1 Localization not working with Accept-Language Header for other cultures except english after deployment

I have implemented localization in .Net Core 3.1 as per https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-3.1. It's working fine on local using QueryString & Accept-Language HTTP header on local but after…
1 2 3
8 9