Multilingual Validation Messages with Umbraco Dictionary Values
Hello,
I'm working on a multilingual project using Umbraco and I've run into an issue with validation messages. I'm trying to use Umbraco's dictionary values to display validation messages in different languages. Here's a snippet of my code:
using ClassLibrary.Models.Abstract;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace ClassLibrary.Models
{
public class LoginModel : PostRedirectModel
{
[Required(ErrorMessage = "@Umbraco.GetDictionaryValue('required test')")]
[Display(Name = "Email")]
public string Email { get; set; } = null!;
[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
[StringLength(256)]
public string Password { get; set; } = null!;
public string? RedirectUrl { get; set; }
}
}
I’m using @Umbraco.GetDictionaryValue('required test') to get the validation message for the ‘Email’ field. However, the output is not as expected and it’s just displaying the whole @Umbraco.GetDictionaryValue('required test') string.
I’ve also set up my site with var langISO = Umbraco.CultureDictionary.Culture.TwoLetterISOLanguageName; for handling multiple languages.
Could anyone guide me on how to correctly implement multilingual validation messages using Umbraco’s dictionary values?
Multilingual Validation Messages with Umbraco Dictionary Values
Hello,
I'm working on a multilingual project using Umbraco and I've run into an issue with validation messages. I'm trying to use Umbraco's dictionary values to display validation messages in different languages. Here's a snippet of my code:
I’m using
@Umbraco.GetDictionaryValue('required test')
to get the validation message for the ‘Email’ field. However, the output is not as expected and it’s just displaying the whole@Umbraco.GetDictionaryValue('required test')
string.I’ve also set up my site with
var langISO = Umbraco.CultureDictionary.Culture.TwoLetterISOLanguageName;
for handling multiple languages.Could anyone guide me on how to correctly implement multilingual validation messages using Umbraco’s dictionary values?
Thank you in advance!
is working on a reply...