diff --git a/ProjectLighthouse.Localization/General.resx b/ProjectLighthouse.Localization/General.resx new file mode 100644 index 00000000..2e014ac5 --- /dev/null +++ b/ProjectLighthouse.Localization/General.resx @@ -0,0 +1,39 @@ + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Username + + + Password + + + Register + + + Forgot Password? + + + Uh oh! + + + Log In + + \ No newline at end of file diff --git a/ProjectLighthouse.Localization/LocalizationManager.cs b/ProjectLighthouse.Localization/LocalizationManager.cs index 6f63cf8a..ef4a6358 100644 --- a/ProjectLighthouse.Localization/LocalizationManager.cs +++ b/ProjectLighthouse.Localization/LocalizationManager.cs @@ -26,9 +26,19 @@ public static class LocalizationManager // e.g. BaseLayout.resx as opposed to BaseLayout.lang-da-DK.resx. if (language != DefaultLang) resourceBasename += $".lang-{language}"; - ResourceManager resourceManager = new(resourceBasename, Assembly.GetExecutingAssembly()); + string? localizedString = null; + try + { + ResourceManager resourceManager = new(resourceBasename, + Assembly.GetExecutingAssembly()); - string? localizedString = resourceManager.GetString(key); + localizedString = resourceManager.GetString(key); + } + catch + { + // ignored + } + if (localizedString == null) { #if DEBUG diff --git a/ProjectLighthouse.Localization/LoggedOut.resx b/ProjectLighthouse.Localization/LoggedOut.resx new file mode 100644 index 00000000..2d555c7e --- /dev/null +++ b/ProjectLighthouse.Localization/LoggedOut.resx @@ -0,0 +1,30 @@ + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Logged Out + + + You have been successfully logged out. You will be redirected in 5 seconds, or you may click below to do so manually. + + + Redirect + + \ No newline at end of file diff --git a/ProjectLighthouse.Localization/ProjectLighthouse.Localization.csproj b/ProjectLighthouse.Localization/ProjectLighthouse.Localization.csproj index f6397a51..57dfbc18 100644 --- a/ProjectLighthouse.Localization/ProjectLighthouse.Localization.csproj +++ b/ProjectLighthouse.Localization/ProjectLighthouse.Localization.csproj @@ -13,6 +13,14 @@ ResXFileCodeGenerator LandingPage.Designer.cs + + ResXFileCodeGenerator + General.Designer.cs + + + ResXFileCodeGenerator + LoggedOut.Designer.cs + diff --git a/ProjectLighthouse.Localization/StringLists/GeneralStrings.cs b/ProjectLighthouse.Localization/StringLists/GeneralStrings.cs new file mode 100644 index 00000000..db134368 --- /dev/null +++ b/ProjectLighthouse.Localization/StringLists/GeneralStrings.cs @@ -0,0 +1,13 @@ +namespace LBPUnion.ProjectLighthouse.Localization.StringLists; + +public static class GeneralStrings +{ + public static readonly TranslatableString Username = create("username"); + public static readonly TranslatableString Password = create("password"); + public static readonly TranslatableString Register = create("register"); + public static readonly TranslatableString ForgotPassword = create("forgot_password"); + public static readonly TranslatableString Error = create("error"); + public static readonly TranslatableString LogIn = create("log_in"); + + private static TranslatableString create(string key) => new(TranslationAreas.General, key); +} \ No newline at end of file diff --git a/ProjectLighthouse.Localization/StringLists/LoggedOutStrings.cs b/ProjectLighthouse.Localization/StringLists/LoggedOutStrings.cs new file mode 100644 index 00000000..e8ae3bb9 --- /dev/null +++ b/ProjectLighthouse.Localization/StringLists/LoggedOutStrings.cs @@ -0,0 +1,10 @@ +namespace LBPUnion.ProjectLighthouse.Localization.StringLists; + +public static class LoggedOutStrings +{ + public static readonly TranslatableString LoggedOut = create("logged_out"); + public static readonly TranslatableString LoggedOutInfo = create("logged_out_info"); + public static readonly TranslatableString Redirect = create("redirect"); + + private static TranslatableString create(string key) => new(TranslationAreas.LoggedOut, key); +} \ No newline at end of file diff --git a/ProjectLighthouse.Localization/TranslationAreas.cs b/ProjectLighthouse.Localization/TranslationAreas.cs index 0a4523ee..ae90be13 100644 --- a/ProjectLighthouse.Localization/TranslationAreas.cs +++ b/ProjectLighthouse.Localization/TranslationAreas.cs @@ -4,4 +4,6 @@ public enum TranslationAreas { BaseLayout, LandingPage, + General, + LoggedOut, } \ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml b/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml index fbebba49..cedbbdc7 100644 --- a/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/LoginForm.cshtml @@ -1,10 +1,11 @@ @page "/login" @using LBPUnion.ProjectLighthouse.Configuration +@using LBPUnion.ProjectLighthouse.Localization.StringLists @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.LoginForm @{ Layout = "Layouts/BaseLayout"; - Model.Title = "Log in"; + Model.Title = Model.Translate(GeneralStrings.LogIn); } @@ -29,7 +30,7 @@ {
- Uh oh! + @Model.Translate(GeneralStrings.Error)

@Model.Error

@@ -40,17 +41,17 @@
- +
- +
- +
- +
@@ -62,13 +63,13 @@ }
- + @if (ServerConfiguration.Instance.Authentication.RegistrationEnabled) {
- Register + @Model.Translate(GeneralStrings.Register)
} @@ -76,7 +77,7 @@
- Forgot Password? + @Model.Translate(GeneralStrings.ForgotPassword)
\ No newline at end of file diff --git a/ProjectLighthouse.Servers.Website/Pages/LogoutPage.cshtml b/ProjectLighthouse.Servers.Website/Pages/LogoutPage.cshtml index 62f902c1..8854bcb0 100644 --- a/ProjectLighthouse.Servers.Website/Pages/LogoutPage.cshtml +++ b/ProjectLighthouse.Servers.Website/Pages/LogoutPage.cshtml @@ -1,10 +1,16 @@ @page "/logout" +@using LBPUnion.ProjectLighthouse.Localization.StringLists @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.LogoutPage @{ Layout = "Layouts/BaseLayout"; - Model.Title = "Logged out"; + Model.Title = Model.Translate(LoggedOutStrings.LoggedOut); } -

You have been successfully logged out. You will be redirected in 5 seconds, or you may click here to do so manually.

+

@Model.Translate(LoggedOutStrings.LoggedOutInfo)

+ + + @Model.Translate(LoggedOutStrings.Redirect) + + \ No newline at end of file