-
-
Notifications
You must be signed in to change notification settings - Fork 8
Localize TagHelper
Localize views using LocalizeTagHelper
, first it must be added to `ViewImports.cshtml
@addTagHelper *, LazZiya.ExpressLocalization
LocalizeTagHelper
is included inLazZiya.ExpressLocalization
starting from v4.0, for earlier versions it must be installed separately. See the bottom of this page for instructions.
Localize texts/html contents using localize-content
attribute with any html tag
<h1 localize-content>Sample header</h1>
<p localize-content>
sample content...
</p>
Use <localize>
html tag or to localize all its contents
<localize>
<h1>Sample title</h1>
<p>sample contents...</p>
<localize>
Localize attributes like title
inside <img
tag using localize-att-*
<img src="/images/picture.jpg" localize-att-title="Picture title"/>
Force specific culture regardless the request culture
<p localize-culture="tr">
This content will always be localized with TR culture
</p>
Localize a string that contains arguments by providing the arguments using localize-args
@{
var args = new[] { "http://demo.ziyad.info", 8, "Asp.Net Core" }
}
<p localize-args="args">
Visit <a href="{0}">demos website</a> to see a collection of {1} demos about "{2}".
</p>
Localized output sample: Visit demos website to see a collection of 8 demos about "Asp.Net Core".
Specify localization resource type using localize-source
<p localize-source="typeof(SharedResourceType)">
This content will be localized from a specific shared resource.
</p>
See demo page.
4.0