Add strings for entire baselayout

This commit is contained in:
jvyden 2022-04-14 16:50:30 -04:00
parent 3e18d79fa5
commit 1b48a71062
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
3 changed files with 38 additions and 10 deletions

View file

@ -43,4 +43,26 @@
<value>Levels</value>
<comment>A button on the header that takes you to a list of user-uploaded levels. Levels are internally referred to as "slots".</comment>
</data>
<data name="header_authentication" xml:space="preserve">
<value>Authentication</value>
<comment>A button on the header that takes you to a list of authentication attempts.</comment>
</data>
<data name="header_loginRegister" xml:space="preserve">
<value>Login / Register</value>
<comment>A button on the header that lets you log in or register.</comment>
</data>
<data name="header_profile" xml:space="preserve">
<value>Profile</value>
<comment>A quick shortcut on the header to take you to your profile if logged in.</comment>
</data>
<data name="header_adminPanel" xml:space="preserve">
<value>Admin Panel</value>
<comment>A header link that takes you to the admin panel if available.</comment>
</data>
<data name="header_logout" xml:space="preserve">
<value>Log out</value>
<comment>A shortcut to log you out of your account.</comment>
</data>
</root>

View file

@ -6,6 +6,12 @@ public static class BaseLayoutStrings
public static readonly TranslatableString HeaderUsers = create("header_users");
public static readonly TranslatableString HeaderPhotos = create("header_photos");
public static readonly TranslatableString HeaderSlots = create("header_slots");
public static readonly TranslatableString HeaderAuthentication = create("header_authentication");
public static readonly TranslatableString HeaderLoginRegister = create("header_loginRegister");
public static readonly TranslatableString HeaderProfile = create("header_profile");
public static readonly TranslatableString HeaderAdminPanel = create("header_adminPanel");
public static readonly TranslatableString HeaderLogout = create("header_logout");
private static TranslatableString create(string key) => new(TranslationAreas.BaseLayout, key);
}

View file

@ -1,6 +1,6 @@
@using LBPUnion.ProjectLighthouse.Helpers
@using LBPUnion.ProjectLighthouse.Helpers.Extensions
@using LBPUnion.ProjectLighthouse.Localization
@using LBPUnion.ProjectLighthouse.Localization.StringLists
@using LBPUnion.ProjectLighthouse.Types
@using LBPUnion.ProjectLighthouse.Types.Settings
@model LBPUnion.ProjectLighthouse.Pages.Layouts.BaseLayout
@ -8,21 +8,21 @@
@{
if (Model!.User == null)
{
Model.NavigationItemsRight.Add(new PageNavigationItem(new TranslatableString(TranslationAreas.BaseLayout, "Login / Register"), "/login", "sign in"));
Model.NavigationItemsRight.Add(new PageNavigationItem(BaseLayoutStrings.HeaderLoginRegister, "/login", "sign in"));
}
else
{
if (ServerSettings.Instance.UseExternalAuth)
{
Model.NavigationItems.Add(new PageNavigationItem(new TranslatableString(TranslationAreas.BaseLayout, "Authentication"), "/authentication", "key"));
Model.NavigationItems.Add(new PageNavigationItem(BaseLayoutStrings.HeaderAuthentication, "/authentication", "key"));
}
Model.NavigationItemsRight.Add(new PageNavigationItem(new TranslatableString(TranslationAreas.BaseLayout, "Profile"), "/user/" + Model.User.UserId, "user alternate"));
Model.NavigationItemsRight.Add(new PageNavigationItem(BaseLayoutStrings.HeaderProfile, "/user/" + Model.User.UserId, "user alternate"));
@if (Model.User.IsAdmin)
{
Model.NavigationItemsRight.Add(new PageNavigationItem(new TranslatableString(TranslationAreas.BaseLayout, "Admin Panel"), "/admin", "cogs"));
Model.NavigationItemsRight.Add(new PageNavigationItem(BaseLayoutStrings.HeaderAdminPanel, "/admin", "cogs"));
}
Model.NavigationItemsRight.Add(new PageNavigationItem(new TranslatableString(TranslationAreas.BaseLayout, "Log out"), "/logout", "user alternate slash")); // should always be last
Model.NavigationItemsRight.Add(new PageNavigationItem(BaseLayoutStrings.HeaderLogout, "/logout", "user alternate slash")); // should always be last
}
Model.IsMobile = Model.Request.IsMobile();