I am a webform guy who wants to move to ASP.Net Core & Blazor I don't have any background in MVC
just in case someone may give their feedback based on MVC
.
I am interested in ASP.Net Core Razor page only.
In web form I use two files for a multilingual website, for example, I can keep related validation messages in .aspx page or in related js files if necessary, while in Core it does things differently. In webform I can keep validation message in .aspx file itself while in ASP.Net core I have been using Single Model class and Validation message is defined there.
Webform structure
-en
--index
--aboutus
..
..
-ar
--index
--aboutus
ASP.Net Core folder structure
Pages
-en
--index
--aboutus
..
..
-ar
--index
--aboutus
Let us say under Pages
folder I create two folders one for English & another for Arabic and in Core we let us say I have defined my validation in Model file. Since I have one model file for both languages how can I show language specific validation message
Below code is just for example
using System;
using System.ComponentModel.DataAnnotations;
public class Starship
{
[Required]
[StringLength(16,
ErrorMessage = "Identifier too long (16 character limit).")]
public string Identifier { get; set; }
public string Description { get; set; }
[Required]
public string Classification { get; set; }
[Range(1, 100000,
ErrorMessage = "Accommodation invalid (1-100000).")]
public int MaximumAccommodation { get; set; }
[Required]
[Range(typeof(bool), "true", "true",
ErrorMessage = "This form disallows unapproved ships.")]
public bool IsValidatedDesign { get; set; }
[Required]
public DateTime ProductionDate { get; set; }
}
Problem i am facing since i have one Model file which have validation in English how can i show Validation in Arabic in most easy & simple way in ASP.Net core
Assuming my URL is like
www.example.com/en/
www.example.com/en/aboutus/
www.example.com/en/contact/
www.example.com/ar/
www.example.com/ar/aboutus/
www.example.com/ar/contact/
Can language based validation message shows just based on above URL without using any globalization feature for website pages which has any forms etc..