Hello Everybody,
I'm new in hier and I need some Help. I follow this example
http://www.c-sharpcorner.com/UploadFile/4d9083/globalization-and-localization-in-Asp-Net-mvc-4/
to create a asp.net Mvc app in English and German, but to my supprise the App is only showing German and not English.
I don't know what a did wrog hier is my code.
Home Controller:
- namespace FirstCargoApp.Controllers
- {
- public class HomeController : BaseController
- {
- public ActionResult Index()
- {
- return View(new LoginViewModel());
- }
- public ActionResult ChangeCurrentCulture(int id)
- {
-
-
-
- LocalisationHelper.CurrentCulture = id;
-
-
-
- Session["CurrentCulture"] = id;
-
-
-
- return Redirect(Request.UrlReferrer.ToString());
- }
- }
- }
LoginView:
- @model FirstCargoApp.Models.LoginViewModel
- @{
- ViewBag.Title = "Anmelden";
- }
- @ViewBag.Title.
-
- @using (Html.BeginForm("Login", "Account", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
- {
- @Html.AntiForgeryToken()
- Lokales Konto für die Anmeldung verwenden.
-
- @Html.ValidationSummary(true)
- @Html.LabelFor(model => model.UserName, new { @class = "col-md-2 control-label" })
- @Html.TextBoxFor(model => model.UserName, new { @class = "form-control" })
- @Html.ValidationMessageFor(model => model.UserName)
- @Html.LabelFor(m => m.Password, new { @class = "col-md-2 control-label" })
- @Html.PasswordFor(m => m.Password, new { @class = "form-control" })
- @Html.ValidationMessageFor(m => m.Password)
- @Html.CheckBoxFor(m => m.RememberMe)
- @Html.LabelFor(m => m.RememberMe)
- Anmelden
-
- @Html.ActionLink("Registrieren", "Register") wenn Sie kein lokales Konto besitzen.
-
- }
- @*
- @Html.Partial("_ExternalLoginsListPartial", new { Action = "ExternalLogin", ReturnUrl = ViewBag.ReturnUrl })
- *@
- @section Scripts {
- @Scripts.Render("~/bundles/jqueryval")
- }
- using FirstCargoApp.LocalResource;
- namespace FirstCargoApp.Models
- {
- public class ExternalLoginConfirmationViewModel
- {
- [Required]
- [Display(Name = "UserName", ResourceType = typeof(Resource))]
- public string UserName { get; set; }
- }
- public class ManageUserViewModel
- {
- [Required]
- [DataType(DataType.Password)]
- [Display(Name = "Aktuelles Kennwort")]
- public string OldPassword { get; set; }
- [Required]
- [StringLength(100, ErrorMessage = "\"{0}\" muss mindestens {2} Zeichen lang sein.", MinimumLength = 6)]
- [DataType(DataType.Password)]
- [Display(Name = "Neues Kennwort")]
- public string NewPassword { get; set; }
- [DataType(DataType.Password)]
- [Display(Name = "Neues Kennwort bestätigen")]
- [Compare("NewPassword", ErrorMessage = "Das neue Kennwort stimmt nicht mit dem Bestätigungskennwort überein.")]
- public string ConfirmPassword { get; set; }
- }
- public class LoginViewModel
- {
- [Required]
- [Display(Name = "UserName", ResourceType = typeof(Resource))]
- public string UserName { get; set; }
- [Required]
- [DataType(DataType.Password)]
- [Display(Name = "Password", ResourceType = typeof(Resource))]
- public string Password { get; set; }
- [Display(Name = "Speichern?")]
- public bool RememberMe { get; set; }
- }
I have 3 Resource Files
Resource.en-GB
Resource.de-DE
Resource
For the rest i just copy it from the Tutorial up.
Please can someone help me
Thanks