Using Globalize - ASP.NET Core Localization Demo (2024)

Material Light

Using Globalize - ASP.NET Core Localization Demo (1) Material Blue Light

Using Globalize - ASP.NET Core Localization Demo (2) Material Lime Light

Using Globalize - ASP.NET Core Localization Demo (3) Material Orange Light

Using Globalize - ASP.NET Core Localization Demo (4) Material Purple Light

Using Globalize - ASP.NET Core Localization Demo (5) Material Teal Light

Material Dark

Using Globalize - ASP.NET Core Localization Demo (6) Material Blue Dark

Using Globalize - ASP.NET Core Localization Demo (7) Material Lime Dark

Using Globalize - ASP.NET Core Localization Demo (8) Material Orange Dark

Using Globalize - ASP.NET Core Localization Demo (9) Material Purple Dark

Using Globalize - ASP.NET Core Localization Demo (10) Material Teal Dark

Material Light Compact

Using Globalize - ASP.NET Core Localization Demo (11) Material Blue Light Compact

Using Globalize - ASP.NET Core Localization Demo (12) Material Lime Light Compact

Using Globalize - ASP.NET Core Localization Demo (13) Material Orange Light Compact

Using Globalize - ASP.NET Core Localization Demo (14) Material Purple Light Compact

Using Globalize - ASP.NET Core Localization Demo (15) Material Teal Light Compact

Material Dark Compact

Using Globalize - ASP.NET Core Localization Demo (16) Material Blue Dark Compact

Using Globalize - ASP.NET Core Localization Demo (17) Material Lime Dark Compact

Using Globalize - ASP.NET Core Localization Demo (18) Material Orange Dark Compact

Using Globalize - ASP.NET Core Localization Demo (19) Material Purple Dark Compact

Using Globalize - ASP.NET Core Localization Demo (20) Material Teal Dark Compact

Generic Light

Using Globalize - ASP.NET Core Localization Demo (21) Generic Light

Using Globalize - ASP.NET Core Localization Demo (22) Carmine

Using Globalize - ASP.NET Core Localization Demo (23) Soft Blue

Using Globalize - ASP.NET Core Localization Demo (24) Green Mist

Generic Dark

Using Globalize - ASP.NET Core Localization Demo (25) Generic Dark

Using Globalize - ASP.NET Core Localization Demo (26) Contrast

Using Globalize - ASP.NET Core Localization Demo (27) Dark Violet

Using Globalize - ASP.NET Core Localization Demo (28) Dark Moon

Generic Light Compact

Using Globalize - ASP.NET Core Localization Demo (29) Generic Light Compact

Generic Dark Compact

Using Globalize - ASP.NET Core Localization Demo (30) Generic Dark Compact

Using Globalize - ASP.NET Core Localization Demo (31) Contrast Dark Compact

Fluent Light

Using Globalize - ASP.NET Core Localization Demo (32) Fluent Light

Using Globalize - ASP.NET Core Localization Demo (33) Fluent SaaS Light

Fluent Dark

Using Globalize - ASP.NET Core Localization Demo (34) Fluent Dark

Using Globalize - ASP.NET Core Localization Demo (35) Fluent SaaS Dark

Fluent Light Compact

Using Globalize - ASP.NET Core Localization Demo (36) Fluent Light Compact

Using Globalize - ASP.NET Core Localization Demo (37) Fluent SaaS Light Compact

Fluent Dark Compact

Using Globalize - ASP.NET Core Localization Demo (38) Fluent Dark Compact

Using Globalize - ASP.NET Core Localization Demo (39) Fluent SaaS Dark Compact

Backend API

@section ExternalDependencies { <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/event.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/supplemental.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cldrjs/0.4.4/cldr/unresolved.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/message.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/number.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/currency.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/globalize/1.1.1/globalize/date.min.js"></script>}@section Localization { <script src="@Url.Action( "CldrData", "Localization", new { t = CldrDataScriptBuilder.GetCacheParam() })"></script> <script src="https://cdn3.devexpress.com/jslib/23.2.5/js/localization/dx.messages.de.js"></script> <script src="https://cdn3.devexpress.com/jslib/23.2.5/js/localization/dx.messages.ru.js"></script>}@model IEnumerable<DevExtreme.NETCore.Demos.Models.Payment><div id="data-grid-demo"> @(Html.DevExtreme().DataGrid() .DataSource(Model) .Columns(columns => { columns.Add().DataField("PaymentId") .Caption(new JS("formatMessage('Number')")) .Width(100) .AllowEditing(false); columns.Add().DataField("ContactName") .Caption(new JS("formatMessage('Contact')")); columns.Add().DataField("CompanyName") .Caption(new JS("formatMessage('Company')")); columns.Add().DataField("Amount") .Caption(new JS("formatMessage('Amount')")) .DataType(GridColumnDataType.Number) .Format(Format.Currency) .EditorOptions(new { format = "currency", showClearButton = true }); columns.Add().DataField("PaymentDate") .Caption(new JS("formatMessage('PaymentDate')")) .DataType(GridColumnDataType.Date); }) .FilterRow(filterRow => filterRow .Visible(true) .ApplyFilter(GridApplyFilterMode.Auto) ) .Editing(c => c .Mode(GridEditMode.Popup) .AllowUpdating(true) .Popup(e => e .Width(700) .Height(345) ) ) ) <div class="options"> <div class="caption">Options</div> <div class="option"> <label for="selectInput">Language</label> @(Html.DevExtreme().SelectBox() .ID("selectBox") .InputAttr("id", "selectInput") .InputAttr("aria-label", "Language") .DataSource(new JS("locales")) .DisplayExpr("name") .ValueExpr("value") .Value(new JS("locale")) .OnValueChanged("changeLocale") ) </div> </div></div><script> var dictionary = { "en": { "Number": "Number", "Contact": "Contact", "Company": "Company", "Amount": "Amount", "PaymentDate": "Payment Date" }, "de": { "Number": "Nummer", "Contact": "Ansprechpartner", "Company": "Firma", "Amount": "Betrag", "PaymentDate": "Zahlungsdatum" }, "ru": { "Number": "Номер", "Contact": "Имя", "Company": "Организация", "Amount": "Сумма", "PaymentDate": "Дата оплаты" } }; Globalize.loadMessages(dictionary); var formatMessage = Globalize.formatMessage.bind(Globalize); var locales = [ { name: "English", value: "en" }, { name: "Deutsch", value: "de" }, { name: "Русский", value: "ru" } ]; var locale = getLocale(); Globalize.locale(locale); function changeLocale(data) { setLocale(data.value); document.location.reload(); } function getLocale() { var locale = sessionStorage.getItem("locale"); return locale != null ? locale : "en"; } function setLocale(locale) { sessionStorage.setItem("locale", locale); }</script>

using DevExtreme.AspNet.Mvc;using DevExtreme.NETCore.Demos.Models.SampleData;using Microsoft.AspNetCore.Mvc;using System.Linq;namespace DevExtreme.NETCore.Demos.Controllers { public class LocalizationController : Controller { public ActionResult UsingGlobalize() { return View(SampleData.Payments); } public ActionResult CldrData() { return new CldrDataScriptBuilder() .SetCldrPath("~/wwwroot/cldr-data") .UseLocales(new[] { "de", "ru" }) .Build(); } }}

using System;using System.Collections.Generic;using System.Linq;namespace DevExtreme.NETCore.Demos.Models { public class Payment { public int PaymentId { get; set; } public string ContactName { get; set; } public string CompanyName { get; set; } public int Amount { get; set; } public DateTime PaymentDate { get; set; } }}

using System;using System.Collections.Generic;namespace DevExtreme.NETCore.Demos.Models.SampleData { public partial class SampleData { public static readonly IEnumerable<Payment> Payments = new[] { new Payment { PaymentId = 1, ContactName = "Nancy Davolio", CompanyName = "Premier Buy", Amount = 1740, PaymentDate = DateTime.Parse("2013/01/06") }, new Payment { PaymentId = 2, ContactName = "Andrew Fuller", CompanyName = "ElectrixMax", Amount = 850, PaymentDate = DateTime.Parse("2013/01/13") }, new Payment { PaymentId = 3, ContactName = "Janet Leverling", CompanyName = "Video Emporium", Amount = 2235, PaymentDate = DateTime.Parse("2013/01/07") }, new Payment { PaymentId = 4, ContactName = "Margaret Peaco*ck", CompanyName = "Screen Shop", Amount = 1965, PaymentDate = DateTime.Parse("2013/01/03") }, new Payment { PaymentId = 5, ContactName = "Steven Buchanan", CompanyName = "Braeburn", Amount = 880, PaymentDate = DateTime.Parse("2013/01/10") }, new Payment { PaymentId = 6, ContactName = "Michael Suyama", CompanyName = "PriceCo", Amount = 5260, PaymentDate = DateTime.Parse("2013/01/17") }, new Payment { PaymentId = 7, ContactName = "Robert King", CompanyName = "Ultimate Gadget", Amount = 2790, PaymentDate = DateTime.Parse("2013/01/21") }, new Payment { PaymentId = 8, ContactName = "Laura Callahan", CompanyName = "EZ Stop", Amount = 3140, PaymentDate = DateTime.Parse("2013/01/01") }, new Payment { PaymentId = 9, ContactName = "Anne Dodsworth", CompanyName = "Clicker", Amount = 6175, PaymentDate = DateTime.Parse("2013/01/24") }, new Payment { PaymentId = 10, ContactName = "Clark Morgan", CompanyName = "Store of America", Amount = 4575, PaymentDate = DateTime.Parse("2013/01/11") } }; }}

.options { padding: 20px; background-color: rgba(191, 191, 191, 0.15); margin-top: 20px;}.option { margin-top: 10px;}.caption { font-size: 18px; font-weight: 500;}.option > label { margin-right: 10px;}.option > .dx-selectbox { display: inline-block; vertical-align: middle;}

Using Globalize - ASP.NET Core Localization Demo (2024)

FAQs

How do you implement localization and globalization in a .NET core application? ›

Globalizing and localizing an app involves the following tasks:
  1. Make an ASP.NET Core app's content localizable.
  2. Provide localized resources for the cultures the app supports.
  3. Implement a strategy to select the culture for each request.
May 8, 2023

What is localization in C#? ›

Localization is the process of translating an application's resources into localized versions for each culture that the application will support. You should proceed to the localization step only after completing the Localizability review step to verify that the globalized application is ready for localization.

Why use IStringLocalizer? ›

IStringLocalizer and IStringLocalizer<T> were architected to improve productivity when developing localized apps. IStringLocalizer uses the ResourceManager and ResourceReader to provide culture-specific resources at run time. The interface has an indexer and an IEnumerable for returning localized strings.

What is localization in .NET core 8? ›

Localization in . NET Core refers to the process of adapting an application to meet the language and cultural expectations of a specific region or audience. Instead of having a one-size-fits-all approach, localization allows you to tailor your application for different languages, regions, and user preferences.

What is global localization strategy? ›

Global localization is the business practice of adapting a brand's message or product to the local language, culture and customs. Localization is another step in providing a personalized customer experience.

How do you implement a localization strategy? ›

Top 10 Tips to Build a Successful Localization Strategy
  1. Learn about the local audience through market research.
  2. Hire local experts to understand the market opportunity.
  3. Maximize translation and localization.
  4. Translate your media.
  5. Optimize your website for multilingual SEO.
  6. Understand the competition.

What are the 2 types of localization? ›

What Are The Different Types Of Localization?
  • Website localization. Website localization involves adapting a website to the culture and language of the target audience. ...
  • Software localization. ...
  • Audio and video localization. ...
  • Language and cultural localization. ...
  • Multimedia and user experience localization.
Aug 4, 2023

What is the difference between localization and globalization in C#? ›

Localization makes a resource accessible to an audience of a specific locale, while globalization makes a resource accessible by people from different cultures and locales. Localization conveys value to a specific audience, while globalization makes a resource acceptable by people from different cultures and locales.

What is localization with example? ›

The process of designing and building a product so it can be adapted to multiple cultures or languages with minimal effort. For example, a software product might be developed so it can accommodate different language conventions, date and time formats, and formatting instructions. Localization (l10n).

How will you localize an ASP.NET application? ›

To opt-in to localization, we need to modify our Startup file. We'll be registering a few services, configuring options, and registering middleware. All steps that are common-place for additions in an ASP.NET application. Starting in our ConfigureServices method, we need to make a call to AddLocalization .

What is system globalization in C#? ›

The System. Globalization namespace provides classes that assist in localization of applications based on language and culture. The CultureInfo class is the primary container for a set of resources that is used for a specified language and culture implementation.

What is localization in asp net core 6? ›

In ASP.NET Core, localization is an essential feature that enables developers to create multilingual websites and applications. It provides a straightforward way to create and manage localized content, which can improve the user experience and make your application more accessible to a broader audience.

How to use localization in C#? ›

Localization is the process of customizing your application for a given culture and locale. The language needs to be associated with the particular region where it is spoken, and this is done by using locale (language + location). For example: fr is the code for French language. fr-FR means French language in France.

What is the purpose of localization? ›

Enhances User Experience: Localization ensures a more intuitive and engaging experience for users worldwide by adapting your product to the local language and cultural nuances, Increases Revenue Potential: Localization gives access to more potential customers globally, directly impacting your revenue growth.

How is localization done? ›

Localization is a process of modifying, restructuring, and adapting your content for your target audience in a different language. Translation is only part of the process — you'll also need to render the original meaning, intention, and vision to align with your brand, as well as the local values.

How to use localization in an asp net core web api? ›

Setting Up Localization in . NET Core Web API
  1. Project Setup. Begin by creating a new . ...
  2. Configuration. Configure the services required for localization in the Startup. ...
  3. Resource Files. Create resource files (. ...
  4. Implementing Localization. Inside your controller, inject the IStringLocalizer interface. ...
  5. Setting Request Culture.
Jan 2, 2024

How to implement global exception in net core? ›

Use the UseExceptionHandler middleware in ASP.NET Core

A middleware is indicated as a software component inserted into the request processing pipeline which handles the requests and responses. We can use the ASP.NET Core in-build middleware UseExceptionHandler to use as a global exception handler.

How to implement paging in net core? ›

Here's a step-by-step guide on how to achieve this in an ASP.NET Core Web API:
  1. Create a new ASP.NET Core Web API project. ...
  2. Define your model class. ...
  3. Create a custom middleware for logging incoming requests. ...
  4. Configure the custom middleware. ...
  5. Create a controller that handles pagination and filtering.
Aug 17, 2023

How to set development environment in net core? ›

The environment for local machine development can be set in the Properties\launchSettings.json file of the project. Environment values set in launchSettings.json override values set in the system environment. The launchSettings.json file: Is only used on the local development machine.

Top Articles
Latest Posts
Article information

Author: Prof. Nancy Dach

Last Updated:

Views: 6103

Rating: 4.7 / 5 (77 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Prof. Nancy Dach

Birthday: 1993-08-23

Address: 569 Waelchi Ports, South Blainebury, LA 11589

Phone: +9958996486049

Job: Sales Manager

Hobby: Web surfing, Scuba diving, Mountaineering, Writing, Sailing, Dance, Blacksmithing

Introduction: My name is Prof. Nancy Dach, I am a lively, joyous, courageous, lovely, tender, charming, open person who loves writing and wants to share my knowledge and understanding with you.