Merge pull request #385

* Update default language to be en instead of en-US

* Update DefaultRequestCulture to be en
This commit is contained in:
Mondanzo 2022-07-30 23:35:58 +02:00 committed by GitHub
parent a599732894
commit 77edfed0be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 ?? "";
public const string DefaultLang = "en-US"; public const string DefaultLang = "en";
public static string GetLocalizedString(TranslationAreas translationArea, string language, string key) public static string GetLocalizedString(TranslationAreas translationArea, string language, string key)
{ {
@ -21,7 +21,7 @@ public static class LocalizationManager
string resourceBasename = $"{namespaceStr}.{translationArea.ToString()}"; string resourceBasename = $"{namespaceStr}.{translationArea.ToString()}";
// 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 .resx, so if we aren't using en 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}";

View file

@ -45,7 +45,7 @@ public class WebsiteStartup
{ {
List<CultureInfo> languages = LocalizationManager.GetAvailableLanguages().Select(l => new CultureInfo(LocalizationManager.MapLanguage(l))).ToList(); List<CultureInfo> languages = LocalizationManager.GetAvailableLanguages().Select(l => new CultureInfo(LocalizationManager.MapLanguage(l))).ToList();
config.DefaultRequestCulture = new RequestCulture(new CultureInfo("en-US")); config.DefaultRequestCulture = new RequestCulture(new CultureInfo("en"));
config.SupportedCultures = languages; config.SupportedCultures = languages;
config.SupportedUICultures = languages; config.SupportedUICultures = languages;
@ -81,4 +81,4 @@ public class WebsiteStartup
app.UseEndpoints(endpoints => endpoints.MapControllers()); app.UseEndpoints(endpoints => endpoints.MapControllers());
app.UseEndpoints(endpoints => endpoints.MapRazorPages()); app.UseEndpoints(endpoints => endpoints.MapRazorPages());
} }
} }