mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-28 11:42:28 +00:00
Translate login and logout pages
This commit is contained in:
parent
1e9f672d6c
commit
443b285253
9 changed files with 132 additions and 13 deletions
39
ProjectLighthouse.Localization/General.resx
Normal file
39
ProjectLighthouse.Localization/General.resx
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="username" xml:space="preserve">
|
||||
<value>Username</value>
|
||||
</data>
|
||||
<data name="password" xml:space="preserve">
|
||||
<value>Password</value>
|
||||
</data>
|
||||
<data name="register" xml:space="preserve">
|
||||
<value>Register</value>
|
||||
</data>
|
||||
<data name="forgot_password" xml:space="preserve">
|
||||
<value>Forgot Password?</value>
|
||||
</data>
|
||||
<data name="error" xml:space="preserve">
|
||||
<value>Uh oh!</value>
|
||||
</data>
|
||||
<data name="log_in" xml:space="preserve">
|
||||
<value>Log In</value>
|
||||
</data>
|
||||
</root>
|
|
@ -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
|
||||
|
|
30
ProjectLighthouse.Localization/LoggedOut.resx
Normal file
30
ProjectLighthouse.Localization/LoggedOut.resx
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="logged_out" xml:space="preserve">
|
||||
<value>Logged Out</value>
|
||||
</data>
|
||||
<data name="logged_out_info" xml:space="preserve">
|
||||
<value>You have been successfully logged out. You will be redirected in 5 seconds, or you may click below to do so manually.</value>
|
||||
</data>
|
||||
<data name="redirect" xml:space="preserve">
|
||||
<value>Redirect</value>
|
||||
</data>
|
||||
</root>
|
|
@ -13,6 +13,14 @@
|
|||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>LandingPage.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="General.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>General.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="LoggedOut.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>LoggedOut.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
13
ProjectLighthouse.Localization/StringLists/GeneralStrings.cs
Normal file
13
ProjectLighthouse.Localization/StringLists/GeneralStrings.cs
Normal file
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -4,4 +4,6 @@ public enum TranslationAreas
|
|||
{
|
||||
BaseLayout,
|
||||
LandingPage,
|
||||
General,
|
||||
LoggedOut,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue