Skip to content
Use html tag to localize texts and html contents in razor views
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Add .gitignore and .gitattributes. Jun 13, 2019
TagHelpers.Localization.sln Add project files. Jun 13, 2019


Use html tag to localize texts and html contents in razor pages for Asp.Net Core 2.x web applications


Install-Package LazZiya.TagHelpers.Localization -Version 1.0.0

Then inject localize tag helper in _ViewImports.cshtml file

using LazZiya.TagHelpers.Localization
addTagHelpers *, LazZiya.TagHelpers.Localization

Localize TagHelper Usage

Use localize tag directly:

<localize>Hellow world!</localize>

Use localize attributes in any html tag:

<h1 localize-content>Hello world!</h1>

Localize html contents:

<div localize-content>

Use localization args:

<p localize-args="@(new object[] { 123, DateTime.Now })">
    The number is {0}, the date is {1}

Localize attributes e.g. alt attribute:

<img src="/images/lost-image.png" localize-att-alt="Cake and juice image" />


Two nuget packages will be installed automatically with TagHelpers.Localization :

Check for updates after install.

Localization Setup

In order for localize tag helper to work the localization setup must be done in startup.cs as described in LazZiya.ExpressLocalization

Live demos:

You can’t perform that action at this time.