
These messages will be translated to other cultuers by XLocalizer depending on the request culture. So, this is a single place and simple way to customize all error messages.
#Localizer portuguese code
īelow is the fully localized sample of Register.cshtml page, notice that we only need to add “ localize-content” attribute to the relevant tag, that keeps the page code clean and makes it easy to read and update. Dummy class for grouping and accessing resource files public class LocSource Visit DOCS for more details.
This class will be used to access the relevant resource files from the code.
Resources folder: Under the project root create a new folder named “ LocalizationResources”, then inside it create a new empty class named “LocSource”. The main package PM > Install-Package XLocalizer // Online translation support PM > Install-Package XLocalizer.Translate // Translation service PM > Install-Package // Use html tags to localize views PM > Install-Package XLocalizer.TagHelpers // Additional taghelper package for language dropdown PM > Install-Package LazZiya.TagHelpers A few nugets is required to get the best of XLocalizer, first I will mention all pacakges, then we will see the role of each one in the next steps. Use custom translation services for translating resources.Ĭentralization: One single place to easily customize all validation errors, model binding erros and identity errors in a simple way. Use custom resource exporters to export resources from any source to any source. And with the help of built-in resource exportes, all localization resources can be exported from any file/db type to “.resx” file type.Ĭustomization: XLocalizer can be customized in every detail to: net core localization system to XLocalizer or vice versa. Additionally, custom resource types for any other file or db format can be implemented.įlexiblity: XLocalizer is using the standard localization interfaces IStringLocalizer and IHtmlLocalizer, so it is easy to switch from the default. XLocalizer breaks the barriers by offering built-in localization stores (XML, RESX, DB). Support for multiple resource types: By default, Asp.Net Core uses “.resx” resource files for storing localized strings. So, any missed key will be translated and added automatically to the relevant resource file.
Simple localization setup: First of all, it is built to help developers create localized web applications easily without wasting time on developing localization infrastructure.Īuto localization: The most attractive two features of XLocalizer are Auto resource creating and Online translation.