TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Elie Todjom
NA
18
1.1k
Localization with CurrentCulture
Sep 18 2017 3:09 PM
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)
{
//
// Change the current culture for this user.
//
LocalisationHelper.CurrentCulture = id;
//
// Cache the new current culture into the user HTTP session.
//
Session[
"CurrentCulture"
] = id;
//
// Redirect to the same page from where the request was made!
//
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
Reply
Answers (
1
)
Dynamic survey from Json
Scraping data Using AJAX & C#