Description
Persian DataAnnotations as DataAnnotations localizer library, is a localization of System.ComponentModel.DataAnnotations for Persian (Farsi) language. It's useful for Persian ASP.NET Core MVC & ASP.NET MVC based applications. The localization of built-in resource of DataAnnotations is a bit hard to work (specialy in ASP.NET MVC) and this library helps your project for localization error messages just with single call a method. Fork and Translate RESX resources for your language ;-)
PersianDataAnnotations alternatives and similar packages
Based on the "Application Frameworks" category.
Alternatively, view PersianDataAnnotations alternatives based on common mentions on social networks and blogs.
-
CoreFX
The corefx repo contains the library implementation (called "CoreFX") for .NET Core. It includes System.Collections, System.IO, System.Xml and many other components. It builds and runs on Windows. You can 'watch' the repo to see Linux and Mac support being added over the next few months. -
ASP.NET Boilerplate
A starting point for new modern ASP.NET MVC web applications with best practices and most popular tools. -
Orleans
Orleans is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns -
Introducing .NET Multi-platform App UI (MAUI)
.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop. -
Uno Platform
Build Mobile, Desktop and WebAssembly apps with C# and XAML. Today. Open source and professionally supported. -
DotNetty
DotNetty is a port of Netty, asynchronous event-driven network application framework for rapid development of maintainable high performance protocol servers & clients. -
AspectCore Framework
AspectCore Framework is an Aspect-Oriented Programming based cross platform framework for .NET Core and .NET Framework. Core support for aspect-interceptor,dependency injection integration , web applications , data validation , and more. -
Kentor Authentication Services
Saml2 Authentication services for ASP.NET -
Microdot Framework
Microdot: An open source .NET microservices framework -
Spring.Net
Spring.NET is an open source application framework that makes building enterprise .NET applications easier -
X.PagedList
Nugget for easily paging through any IEnumerable/IQueryable in Asp.Net MVC -
Fusion
Make your ASP.NET Core services 10x ... 1000x faster and unleash the power of real-time UI updates with Fusion's change tracking abstractions. -
ASP.NET MVC Boilerplate Framework
ASP.NET MVC Extensions and Helper NuGet packages. -
peasy
Peasy is a middle tier framework that offers an easy to use and flexible rules engine and was designed to address common challenges such as concurrency handling, transactional support, fault tolerance, threading, scalability, async and multiple client support, and easy testability, all without a huge learning curve! -
Mono-Addins
Mono.Addins is a generic framework for creating extensible applications, and for creating add-ins which extend those applications -
Newbe.Claptrap
This is a set of server-side development frameworks with reactive, event sourcing and Actor pattern as basic theories. On top of this, developers can develop "distributed", "scale out", and "easy to test" application more simply. -
Database scaffolding platform
Database scaffolding tool -
HopFramework
HopFramework is a framework to create projects easily applying Domain Driven Design and a lot of patterns to delivery a better solution. -
Simplify.Web
Simplify.Web is a lightweight and fast server-side .NET web-framework based on MVC and OWIN for building HTTP based web-applications, RESTful APIs etc. -
MVCExtensibleRoleManagement
ASP.NET MVC Role-Based Security Example -
Ether.Network
Ether.Network is an open source networking library that allow developers to create simple, fast and scalable socket server or client applications over the TCP/IP protocol.
Get performance insights in less than 4 minutes
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of PersianDataAnnotations or a related project?
README
Persian DataAnnotations
Persian DataAnnotations as DataAnnotations localizer library, is a localization of System.ComponentModel.DataAnnotations for Persian (Farsi) language. It's useful for Persian ASP.NET Core MVC & ASP.NET MVC based applications. The localization of built-in resource of DataAnnotations is a bit hard to work (specialy in ASP.NET MVC) and this library helps your project for localization error messages just with single call a method. Fork
and Translate
RESX resources for your language ;-)
🌟 If you ❤️ library, please star it! 🌟
اعتبار سنجی کنترل ها در .NET با Data Annotation ها
استفاده از DataAnnotation
ها و افزودن [Required]
یا [DataType(DataType.Password)]
یا دیگر Attribute
ها، کار اعتبارسنجی سمت کلاینت را بسیار ساده کرده است. برای فارسی سازی مقادیر پیش فرض کافی است این کتابخانه را با استفاده نیوگت / NuGet یا به صورت دستی به پروژه اضافه کنید.
شیوه استفاده در ASP.NET Core MVC
1- با استفاده از نیوگت / NuGet به سادگی می توانید این کتابخانه را به پروژه خود اضافه کنید
PM> Install-Package PersianDataAnnotationsCore
2- فقط همین یک خط را اضافه کنید و کار تمام میشود
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc(options => options.ModelMetadataDetailsProviders.Add(new PersianDataAnnotationsCore.PersianValidationMetadataProvider()));
}
شیوه استفاده در ASP.NET MVC
1- با استفاده از نیوگت / NuGet به سادگی می توانید این کتابخانه را به پروژه خود اضافه کنید
PM> Install-Package PersianDataAnnotations -Version
2- یعنی فقط همین یک خط را اضافه کنید و کار تمام میشود
protected void Application_Start()
{
PersianDataAnnotations.PersianDataAnnotations.Register();
}
3- فارسی سازی خطاهای مربوط به رمز عبور و قسمت ثبت نام
public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options, IOwinContext context)
{
...
manager.PasswordValidator = new PasswordValidator
/// جایگزین شود با خط زیر
manager.PasswordValidator = new PersianPasswordValidator
...
}
دمو
برای مشاهده دمو می توانید به فرم عضویت یا ورود کاربران در طراحی وب ایران مراجعه کنید
نمونه فارسی سازی خطاهای مربوط به رمز عبور
ترجمه
هنوز احتمال دارد که خطاهایی فارسی نشده باشند. در نسخه های مربوط به پروژه های ASP.NET MVC یک متد استاتیک ترجمه نظیر به نظیر خطا هم اضافه شده که خطاها را می تواند قبل از نمایش تا حد امکان ترجمه کند.
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError("", PersianDataAnnotations.TranslateError.Translate(error));
}
}
متد بالا در کلاس های پیش فرض AccountController یا مشابه آن وجود دارد فقط به آن ترجمه متن خطا اضافه شده است
البته مشابه این متد استاتیک برای نسخه های ASP.NET Core MVC هم ارائه شده است
var result = PersianDataAnnotationsCore.PersianValidationMetadataProvider.ToPersian(value)
نکات
- امکان تغییر
Resource
برای جلوگیری از تکرارErrorMessageResourceType
در هنگامRegisterAdapters
دیده شده است - با جستجوی عنوان پروژه در
NuGet
می توانید از ابزارNuGet
در ویژوال استودیو استفاده کنید و کتابخانه را به سادگی به پروژه اضافه کنید - سعی شده نقطه از آخر پیام ها حذف شود برای انطباق بیشتر با برنامه های چپ به راست
- سعی شده پیام ها با فارسی روان نه پارسی بسیار ادبی و دور از ادبیات عامه بیان شود
- سعی شده از بیشتر از است به جای مصدر نادرست باشیدن استفاده شود
پشتیبانی
لطفا اگر ترجمه بهتری برای یک عبارت یافته اید لطفا اگر مشکلی مشاهده کردید لطفا اگر پیشنهادی دارید
- یا Fork & Pull کنید
- یا Share Issue کنید
- یا لااقل یه تلفن یا موبایل بزنید به طراحی وب ایران
License
The project is dedicated to public and is free for all uses, commercial or otherwise. Supported by Web Design Iran
این پروژه تحت حمایت طراحی وب ایران بوده و برای استفاده تجاری یا غیر تجاری، رایگان است
*Note that all licence references and agreements mentioned in the PersianDataAnnotations README section above
are relevant to that project's source code only.