mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-04-30 16:28:22 +00:00
Merge pull request #385
* Update default language to be en instead of en-US * Update DefaultRequestCulture to be en
This commit is contained in:
parent
a599732894
commit
77edfed0be
2 changed files with 4 additions and 4 deletions
|
@ -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}";
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue