Set default language to en-US

This commit is contained in:
jvyden 2022-04-14 16:53:29 -04:00
parent 1b48a71062
commit 3dd63e6522
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 4 additions and 4 deletions

View file

@ -7,7 +7,7 @@ namespace LBPUnion.ProjectLighthouse.Localization;
public static class LocalizationManager public static class LocalizationManager
{ {
private static readonly string namespaceStr = typeof(LocalizationManager).Namespace ?? ""; private static readonly string namespaceStr = typeof(LocalizationManager).Namespace ?? "";
private const string defaultLang = "en-US"; public const string DefaultLang = "en-US";
public static string GetLocalizedString(TranslationAreas translationArea, string language, string key) public static string GetLocalizedString(TranslationAreas translationArea, string language, string key)
{ {
@ -20,7 +20,7 @@ public static class LocalizationManager
// We don't have an en-US .resx, so if we aren't using en-US then we need to add the appropriate language. // We don't have an en-US .resx, so if we aren't using en-US then we need to add the appropriate language.
// Otherwise, keep it to the normal .resx file // Otherwise, keep it to the normal .resx file
// e.g. BaseLayout.resx as opposed to BaseLayout.lang-da-DK.resx. // e.g. BaseLayout.resx as opposed to BaseLayout.lang-da-DK.resx.
if (language != defaultLang) resourceBasename += $".lang-{language}"; if (language != DefaultLang) resourceBasename += $".lang-{language}";
ResourceManager resourceManager = new(resourceBasename, Assembly.GetExecutingAssembly()); ResourceManager resourceManager = new(resourceBasename, Assembly.GetExecutingAssembly());
@ -50,7 +50,7 @@ public static class LocalizationManager
.Where(r => r != "resources") .Where(r => r != "resources")
.ToList(); .ToList();
languages.Add(defaultLang); languages.Add(DefaultLang);
return languages; return languages;
} }

View file

@ -49,7 +49,7 @@ public class BaseLayout : PageModel
string lang; string lang;
IRequestCultureFeature? requestCulture = Request.HttpContext.Features.Get<IRequestCultureFeature>(); IRequestCultureFeature? requestCulture = Request.HttpContext.Features.Get<IRequestCultureFeature>();
if (requestCulture == null) lang = "en-UD"; // TODO: change to en-US when i can verify this is working if (requestCulture == null) lang = LocalizationManager.DefaultLang;
else else
{ {
lang = requestCulture.RequestCulture.UICulture.Name; lang = requestCulture.RequestCulture.UICulture.Name;