mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-01 16:58:20 +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.
|
// 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());
|
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 (localizedString == null)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#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>
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
<LastGenOutput>LandingPage.Designer.cs</LastGenOutput>
|
<LastGenOutput>LandingPage.Designer.cs</LastGenOutput>
|
||||||
</EmbeddedResource>
|
</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>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</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,
|
BaseLayout,
|
||||||
LandingPage,
|
LandingPage,
|
||||||
|
General,
|
||||||
|
LoggedOut,
|
||||||
}
|
}
|
|
@ -1,10 +1,11 @@
|
||||||
@page "/login"
|
@page "/login"
|
||||||
@using LBPUnion.ProjectLighthouse.Configuration
|
@using LBPUnion.ProjectLighthouse.Configuration
|
||||||
|
@using LBPUnion.ProjectLighthouse.Localization.StringLists
|
||||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.LoginForm
|
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.LoginForm
|
||||||
|
|
||||||
@{
|
@{
|
||||||
Layout = "Layouts/BaseLayout";
|
Layout = "Layouts/BaseLayout";
|
||||||
Model.Title = "Log in";
|
Model.Title = Model.Translate(GeneralStrings.LogIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
<script src="https://geraintluff.github.io/sha256/sha256.min.js"></script>
|
<script src="https://geraintluff.github.io/sha256/sha256.min.js"></script>
|
||||||
|
@ -29,7 +30,7 @@
|
||||||
{
|
{
|
||||||
<div class="ui negative message">
|
<div class="ui negative message">
|
||||||
<div class="header">
|
<div class="header">
|
||||||
Uh oh!
|
@Model.Translate(GeneralStrings.Error)
|
||||||
</div>
|
</div>
|
||||||
<p style="white-space: pre-line">@Model.Error</p>
|
<p style="white-space: pre-line">@Model.Error</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,17 +41,17 @@
|
||||||
<input type="hidden" id="redirect" name="redirect">
|
<input type="hidden" id="redirect" name="redirect">
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Username</label>
|
<label>@Model.Translate(GeneralStrings.Username)</label>
|
||||||
<div class="ui left icon input">
|
<div class="ui left icon input">
|
||||||
<input type="text" name="username" id="text" placeholder="Username">
|
<input type="text" name="username" id="text" placeholder="@Model.Translate(GeneralStrings.Username)">
|
||||||
<i class="user icon"></i>
|
<i class="user icon"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label>Password</label>
|
<label>@Model.Translate(GeneralStrings.Password)</label>
|
||||||
<div class="ui left icon input">
|
<div class="ui left icon input">
|
||||||
<input type="password" id="password" placeholder="Password">
|
<input type="password" id="password" placeholder="@Model.Translate(GeneralStrings.Password)">
|
||||||
<input type="hidden" id="password-submit" name="password">
|
<input type="hidden" id="password-submit" name="password">
|
||||||
<i class="lock icon"></i>
|
<i class="lock icon"></i>
|
||||||
</div>
|
</div>
|
||||||
|
@ -62,13 +63,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<input type="submit" value="Log in" id="submit" class="ui blue button">
|
<input type="submit" value="@Model.Translate(GeneralStrings.LogIn)" id="submit" class="ui blue button">
|
||||||
@if (ServerConfiguration.Instance.Authentication.RegistrationEnabled)
|
@if (ServerConfiguration.Instance.Authentication.RegistrationEnabled)
|
||||||
{
|
{
|
||||||
<a href="/register">
|
<a href="/register">
|
||||||
<div class="ui button">
|
<div class="ui button">
|
||||||
<i class="user alternate add icon"></i>
|
<i class="user alternate add icon"></i>
|
||||||
Register
|
@Model.Translate(GeneralStrings.Register)
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
|
@ -76,7 +77,7 @@
|
||||||
<br/>
|
<br/>
|
||||||
<a href="/passwordResetRequest">
|
<a href="/passwordResetRequest">
|
||||||
<div class="ui button">
|
<div class="ui button">
|
||||||
Forgot Password?
|
@Model.Translate(GeneralStrings.ForgotPassword)
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</form>
|
</form>
|
|
@ -1,10 +1,16 @@
|
||||||
@page "/logout"
|
@page "/logout"
|
||||||
|
@using LBPUnion.ProjectLighthouse.Localization.StringLists
|
||||||
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.LogoutPage
|
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.LogoutPage
|
||||||
|
|
||||||
@{
|
@{
|
||||||
Layout = "Layouts/BaseLayout";
|
Layout = "Layouts/BaseLayout";
|
||||||
Model.Title = "Logged out";
|
Model.Title = Model.Translate(LoggedOutStrings.LoggedOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
<p>You have been successfully logged out. You will be redirected in 5 seconds, or you may click <a href="/">here</a> to do so manually.</p>
|
<p>@Model.Translate(LoggedOutStrings.LoggedOutInfo)</p>
|
||||||
|
|
||||||
|
<a href="/" class="ui blue button">
|
||||||
|
@Model.Translate(LoggedOutStrings.Redirect)
|
||||||
|
</a>
|
||||||
|
|
||||||
<meta http-equiv="refresh" content="5; url=/"/>
|
<meta http-equiv="refresh" content="5; url=/"/>
|
Loading…
Add table
Add a link
Reference in a new issue