mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-28 03:32:27 +00:00
User settings, level settings, language and timezone selection and more. (#471)
* Initial work for user settings page * Finish user setting and slot setting pages * Don't show slot upload date on home page and fix team pick redirection * Fix upload image button alignment on mobile * Fix image upload on iPhone * Remove unused css and add selected button color * Fix login email check and bump ChromeDriver to 105 * Remove duplicated code and allow users to leave fields empty * Add unpublish button on level settings and move settings button position * Don't show edit button on mini card * Self review bug fixes and users can no longer use an in-use email
This commit is contained in:
parent
9073a8266f
commit
f6a7fe6283
53 changed files with 973 additions and 118 deletions
|
@ -1,6 +1,4 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LBPUnion.ProjectLighthouse.Configuration;
|
||||
using LBPUnion.ProjectLighthouse.Localization;
|
||||
using LBPUnion.ProjectLighthouse.Localization.StringLists;
|
||||
|
@ -46,20 +44,31 @@ public class BaseLayout : PageModel
|
|||
}
|
||||
|
||||
private string? language;
|
||||
private string? timeZone;
|
||||
|
||||
public string GetLanguage()
|
||||
{
|
||||
if (ServerStatics.IsUnitTesting) return LocalizationManager.DefaultLang;
|
||||
if (this.language != null) return this.language;
|
||||
|
||||
if (this.User?.IsAPirate ?? false) return "en-PT";
|
||||
if (this.User != null) return this.language = this.User.Language;
|
||||
|
||||
IRequestCultureFeature? requestCulture = Request.HttpContext.Features.Get<IRequestCultureFeature>();
|
||||
IRequestCultureFeature? requestCulture = this.Request.HttpContext.Features.Get<IRequestCultureFeature>();
|
||||
if (requestCulture == null) return this.language = LocalizationManager.DefaultLang;
|
||||
|
||||
return this.language = requestCulture.RequestCulture.UICulture.Name;
|
||||
}
|
||||
|
||||
public string GetTimeZone()
|
||||
{
|
||||
if (ServerStatics.IsUnitTesting) return TimeZoneInfo.Local.Id;
|
||||
if (this.timeZone != null) return this.timeZone;
|
||||
|
||||
string userTimeZone = this.User?.TimeZone ?? TimeZoneInfo.Local.Id;
|
||||
|
||||
return this.timeZone = userTimeZone;
|
||||
}
|
||||
|
||||
public string Translate(TranslatableString translatableString) => translatableString.Translate(this.GetLanguage());
|
||||
public string Translate(TranslatableString translatableString, params object?[] format) => translatableString.Translate(this.GetLanguage(), format);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue