Reader small image

You're reading from  Apps and Services with .NET 8 - Second Edition

Product typeBook
Published inDec 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781837637133
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Mark J. Price
Mark J. Price
author image
Mark J. Price

Mark J. Price is a Microsoft Specialist: Programming in C# and Architecting Microsoft Azure Solutions, with over 20 years' experience. Since 1993, he has passed more than 80 Microsoft programming exams and specializes in preparing others to pass them. Between 2001 and 2003, Mark was employed to write official courseware for Microsoft in Redmond, USA. His team wrote the first training courses for C# while it was still an early alpha version. While with Microsoft, he taught "train-the-trainer" classes to get other MCTs up-to-speed on C# and .NET. Mark holds a Computer Science BSc. Hons. Degree.
Read more about Mark J. Price

Right arrow

Localizing and globalizing with ASP.NET Core

In Chapter 7, Handling Dates, Times, and Internationalization, you learned about working with dates, times, and time zones, and how to globalize and localize a .NET codebase.

In this section, we will look specifically at how to localize a website that uses ASP.NET Core.

As well as localizing string values into languages like French and Spanish using IStringLocalizer, you can localize HTML content using IHtmlLocalizer, but this should be used with care. Usually, HTML markup should be the same for all locales. For views, you can use IViewLocalizer.

Request localization means that the browser can request what culture it prefers in the following ways:

  • Add a query string parameter, for example, ?culture=en-US&ui-culture=en-US.
  • Send a cookie with the request, for example, c=en-US|uic=en-US.
  • Set an HTTP header, for example, Accept-Language: en-US,en;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-GB;q=0.6.

To enable...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Apps and Services with .NET 8 - Second Edition
Published in: Dec 2023Publisher: PacktISBN-13: 9781837637133

Author (1)

author image
Mark J. Price

Mark J. Price is a Microsoft Specialist: Programming in C# and Architecting Microsoft Azure Solutions, with over 20 years' experience. Since 1993, he has passed more than 80 Microsoft programming exams and specializes in preparing others to pass them. Between 2001 and 2003, Mark was employed to write official courseware for Microsoft in Redmond, USA. His team wrote the first training courses for C# while it was still an early alpha version. While with Microsoft, he taught "train-the-trainer" classes to get other MCTs up-to-speed on C# and .NET. Mark holds a Computer Science BSc. Hons. Degree.
Read more about Mark J. Price