Add UserLanguage to IUserIdentity

This commit is contained in:
Haiping Chen 2024-05-11 22:22:14 -05:00
parent e620d5d161
commit 8e2a97e39f
2 changed files with 11 additions and 0 deletions

View file

@ -8,4 +8,5 @@ public interface IUserIdentity
string FirstName { get; }
string LastName { get; }
string FullName { get; }
string? UserLanguage { get; }
}

View file

@ -56,4 +56,14 @@ public class UserIdentity : IUserIdentity
return $"{FirstName} {LastName}".Trim();
}
}
[JsonPropertyName("user_language")]
public string? UserLanguage
{
get
{
_contextAccessor.HttpContext.Request.Headers.TryGetValue("User-Language", out var languages);
return languages.FirstOrDefault();
}
}
}