Urli18nAnnotation.MVCAjax 1.0.0

Easily Localize Ajax Request, Annotate Controllers for Locale In Url Routing. Add localization in website url such that e.g for english language, you can point to /en/login and etc.

Install-Package Urli18nAnnotation.MVCAjax -Version 1.0.0
dotnet add package Urli18nAnnotation.MVCAjax --version 1.0.0
<PackageReference Include="Urli18nAnnotation.MVCAjax" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Urli18nAnnotation.MVCAjax --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

Inside folder App_Start    , look for the file RouteConfig.cs and add the following code inside the RegisterRoutes function  BEFORE ANY other  calls to  routes.MapRoute

 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  routes.MapRoute("Urli18nAnnotation", "{culture}/{controller}/{action}/{id}",
                new { culture = "en", controller = "Home", action = "Index", id = UrlParameter.Optional },
                new { culture = @"^[a-zA-Z]{2}$" }
                );
Then create resource file containing your localizations : see https://msdn.microsoft.com/en-us/library/ms247246(v=vs.100).aspx

your web.config appSettings  already contains
<add key="Urli18nAnnotationDefaultUILanguage" value="en" />

   /// <summary>
   /// for each resx file you create do two things in property manager
   /// 1) change the CustomToolProperty value is PublicResXFileCodeGenerator
   /// 2) change the CustomToolNamespace value is Resources
   ///
   ///
   /// do [Urli18nAnnotation] where ever you need it  To localize the view and the controller  
   /// just add the namespace and just type Resources.NameOfYourResourceString
   /// you can do @Resources.NameOfYourResourceString
   /// In models, you can do
   ///
   /// public class MyModel{
   ///
   /// [Required(ErrorMessageReourceName="TheErrorMessageRequiredUserName", ErrorMessageResourceType=typeof(Resources.Reource))]
   /// [Display(Name="lblUserName", ResourceType=typeof(Resources.Reource))]
   /// public String UserName{   set;   get;  }
   ///
   /// }
   ///
   /// you can also Create a base class and let all your controllers inherit from it
   ///
   ///  [Urli18nAnnotation]
   ///  public class Urll10nAnnotationBaseController : Controller { }
   /// </summary>


load jquery

then
example Ajax request
//pass
//getAjaxi18Trans(["String1"],"Resource1","",function(data){console.log(JSON.stringify(data))});
//get
//[{"word":"String1","trans":"ddsdsd"},{"word":"String1","trans":"String1"}]

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 680 1/7/2014