Urli18nAnnotation.MVC
1.0.0.14
dotnet add package Urli18nAnnotation.MVC --version 1.0.0.14
NuGet\Install-Package Urli18nAnnotation.MVC -Version 1.0.0.14
<PackageReference Include="Urli18nAnnotation.MVC" Version="1.0.0.14" />
<PackageVersion Include="Urli18nAnnotation.MVC" Version="1.0.0.14" />
<PackageReference Include="Urli18nAnnotation.MVC" />
paket add Urli18nAnnotation.MVC --version 1.0.0.14
#r "nuget: Urli18nAnnotation.MVC, 1.0.0.14"
#:package Urli18nAnnotation.MVC@1.0.0.14
#addin nuget:?package=Urli18nAnnotation.MVC&version=1.0.0.14
#tool nuget:?package=Urli18nAnnotation.MVC&version=1.0.0.14
.NET MVC Package To Annotate Controllers Accepting Locale In Url Routing. Add localization in website url such that e.g for english language, you can point to /en/login and so on
Learn more about Target Frameworks and .NET Standard.
-
- jQuery (>= 1.7.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|
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
//pass
//Ajaxi18Resource(["String1"],"Resources.Resource1",function(data){console.log(JSON.stringify(data))});
//get
//[{"word":"String1","trans":"ddsdsd"},{"word":"String1","trans":"String1"}]