Translate profile page

This commit is contained in:
jvyden 2022-08-01 18:29:43 -04:00
parent d9e299ac00
commit 018d9d2b9f
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
9 changed files with 78 additions and 7 deletions

View file

@ -65,4 +65,10 @@
<value>Log out</value> <value>Log out</value>
<comment>A shortcut to log you out of your account.</comment> <comment>A shortcut to log you out of your account.</comment>
</data> </data>
<data name="generated_by" xml:space="preserve">
<value>Page generated by {0}.</value>
</data>
<data name="generated_modified" xml:space="preserve">
<value>This page was generated using a modified version of Project Lighthouse. Please make sure you are properly disclosing the source code to any users who may be using this instance.</value>
</data>
</root> </root>

View file

@ -42,4 +42,16 @@
<data name="success" xml:space="preserve"> <data name="success" xml:space="preserve">
<value>Success!</value> <value>Success!</value>
</data> </data>
<data name="reset_password" xml:space="preserve">
<value>Reset Password</value>
</data>
<data name="recent_activity" xml:space="preserve">
<value>Recent Activity</value>
</data>
<data name="soon" xml:space="preserve">
<value>Coming soon!</value>
</data>
<data name="recent_photos" xml:space="preserve">
<value>Most recent photos</value>
</data>
</root> </root>

View 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="biography" xml:space="preserve">
<value>Biography</value>
</data>
<data name="no_biography" xml:space="preserve">
<value>{0} hasn't introduced themselves yet.</value>
</data>
<data name="title" xml:space="preserve">
<value>{0}'s user page</value>
</data>
</root>

View file

@ -32,6 +32,10 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Error.Designer.cs</LastGenOutput> <LastGenOutput>Error.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Update="Profile.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Profile.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -13,5 +13,8 @@ public static class BaseLayoutStrings
public static readonly TranslatableString HeaderAdminPanel = create("header_adminPanel"); public static readonly TranslatableString HeaderAdminPanel = create("header_adminPanel");
public static readonly TranslatableString HeaderLogout = create("header_logout"); public static readonly TranslatableString HeaderLogout = create("header_logout");
public static readonly TranslatableString GeneratedBy = create("generated_by");
public static readonly TranslatableString GeneratedModified = create("generated_modified");
private static TranslatableString create(string key) => new(TranslationAreas.BaseLayout, key); private static TranslatableString create(string key) => new(TranslationAreas.BaseLayout, key);
} }

View file

@ -5,11 +5,15 @@ public static class GeneralStrings
public static readonly TranslatableString Username = create("username"); public static readonly TranslatableString Username = create("username");
public static readonly TranslatableString Password = create("password"); public static readonly TranslatableString Password = create("password");
public static readonly TranslatableString Register = create("register"); public static readonly TranslatableString Register = create("register");
public static readonly TranslatableString ResetPassword = create("reset_password");
public static readonly TranslatableString ForgotPassword = create("forgot_password"); public static readonly TranslatableString ForgotPassword = create("forgot_password");
public static readonly TranslatableString Success = create("success"); public static readonly TranslatableString Success = create("success");
public static readonly TranslatableString Error = create("error"); public static readonly TranslatableString Error = create("error");
public static readonly TranslatableString LogIn = create("log_in"); public static readonly TranslatableString LogIn = create("log_in");
public static readonly TranslatableString Unknown = create("unknown"); public static readonly TranslatableString Unknown = create("unknown");
public static readonly TranslatableString RecentPhotos = create("recent_photos");
public static readonly TranslatableString RecentActivity = create("recent_activity");
public static readonly TranslatableString Soon = create("soon");
private static TranslatableString create(string key) => new(TranslationAreas.General, key); private static TranslatableString create(string key) => new(TranslationAreas.General, key);
} }

View file

@ -0,0 +1,10 @@
namespace LBPUnion.ProjectLighthouse.Localization.StringLists;
public static class ProfileStrings
{
public static readonly TranslatableString Title = create("title");
public static readonly TranslatableString Biography = create("biography");
public static readonly TranslatableString NoBiography = create("no_biography");
private static TranslatableString create(string key) => new(TranslationAreas.Profile, key);
}

View file

@ -9,4 +9,5 @@ public enum TranslationAreas
Status, Status,
Register, Register,
Error, Error,
Profile,
} }

View file

@ -1,6 +1,7 @@
@page "/user/{userId:int}" @page "/user/{userId:int}"
@using System.Web @using System.Web
@using LBPUnion.ProjectLighthouse.Extensions @using LBPUnion.ProjectLighthouse.Extensions
@using LBPUnion.ProjectLighthouse.Localization.StringLists
@using LBPUnion.ProjectLighthouse.PlayerData @using LBPUnion.ProjectLighthouse.PlayerData
@using LBPUnion.ProjectLighthouse.Types @using LBPUnion.ProjectLighthouse.Types
@model LBPUnion.ProjectLighthouse.Servers.Website.Pages.UserPage @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.UserPage
@ -9,7 +10,7 @@
Layout = "Layouts/BaseLayout"; Layout = "Layouts/BaseLayout";
Model.ShowTitleInPage = false; Model.ShowTitleInPage = false;
Model.Title = Model.ProfileUser!.Username + "'s user page"; Model.Title = Model.Translate(ProfileStrings.Title, Model.ProfileUser!.Username);
Model.Description = Model.ProfileUser!.Biography; Model.Description = Model.ProfileUser!.Biography;
} }
@ -74,16 +75,16 @@
{ {
<a class="ui blue button" href="/passwordReset"> <a class="ui blue button" href="/passwordReset">
<i class="key icon"></i> <i class="key icon"></i>
<span>Reset Password</span> <span>@Model.Translate(GeneralStrings.ResetPassword)</span>
</a> </a>
} }
</div> </div>
<div class="eight wide column"> <div class="eight wide column">
<div class="ui blue segment"> <div class="ui blue segment">
<h2>Biography</h2> <h2>@Model.Translate(ProfileStrings.Biography)</h2>
@if (string.IsNullOrWhiteSpace(Model.ProfileUser.Biography)) @if (string.IsNullOrWhiteSpace(Model.ProfileUser.Biography))
{ {
<p>@Model.ProfileUser.Username hasn't introduced themselves yet</p> <p>@Model.Translate(ProfileStrings.NoBiography, Model.ProfileUser.Username)</p>
} }
else else
{ {
@ -93,8 +94,8 @@
</div> </div>
<div class="eight wide column"> <div class="eight wide column">
<div class="ui red segment"> <div class="ui red segment">
<h2>Recent Activity</h2> <h2>@Model.Translate(GeneralStrings.RecentActivity)</h2>
<p>Coming soon!</p> <p>@Model.Translate(GeneralStrings.Soon)</p>
</div> </div>
</div> </div>
</div> </div>
@ -103,7 +104,7 @@
@if (Model.Photos != null && Model.Photos.Count != 0) @if (Model.Photos != null && Model.Photos.Count != 0)
{ {
<div class="ui purple segment"> <div class="ui purple segment">
<h2>Most recent photos</h2> <h2>@Model.Translate(GeneralStrings.RecentPhotos)</h2>
<div class="ui center aligned grid"> <div class="ui center aligned grid">
@foreach (Photo photo in Model.Photos) @foreach (Photo photo in Model.Photos)