Skip to content

Commit

Permalink
Layouts moved to StringLocalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
dyatlov-a committed Oct 19, 2024
1 parent 8dad95b commit e18b165
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 90 deletions.
11 changes: 0 additions & 11 deletions src/Inc.TeamAssistant.Gateway/wwwroot/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"GUI_Tasks": "tasks",
"GUI_StoryList": "Tasks list",
"GUI_AssessmentSession": "Assessment Session",
"GUI_MainTitle": "Team assistant",
"GUI_MainHeader": "Chatbots for optimization",
"GUI_MainSubHeader": "processes in teams",
"GUI_ToolAppraiser": "easy task estimation",
Expand All @@ -89,8 +88,6 @@
"GUI_CreateBotLink": "Create your bot",
"GUI_VideoNotSupported": "Your browser does not support HTML5 video.",
"GUI_DataRefreshed": "Successfully updated",

"Navigation_Logout": "Logout",

"CheckIn_GetStarted": "To get started, please add the bot to your chat room",
"CheckIn_DefaultLayerTitle": "All",
Expand Down Expand Up @@ -235,14 +232,6 @@
"Dashboard_Apply": "Apply",
"Dashboard_SettingsApplied": "Settings applied",
"Dashboard_DisableWidgetHelpTemplate": "To enable the widget, you need to activate the feature \"{0}\"",

"Footer_GroupNavigation": "Navigation",
"Footer_GroupTech": "Tech",
"Footer_GroupStorage": "Storage",
"Footer_GroupTools": "Tools",
"Footer_LinkMain": "Main",
"Footer_LinkConstructor": "Constructor",
"Footer_LinkDashboard": "Dashboard",

"Login_AsSuperuserText": "Log in as superuser",
"Login_Title": "Login",
Expand Down
11 changes: 0 additions & 11 deletions src/Inc.TeamAssistant.Gateway/wwwroot/langs/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"GUI_Tasks": "задач",
"GUI_StoryList": "Список историй",
"GUI_AssessmentSession": "Оценка задач",
"GUI_MainTitle": "Team assistant | ассистент для команд",
"GUI_MainHeader": "Чат-боты для оптимизации",
"GUI_MainSubHeader": "процессов в командах",
"GUI_ToolAppraiser": "легкая оценка задач",
Expand All @@ -89,8 +88,6 @@
"GUI_CreateBotLink": "Создать бота",
"GUI_VideoNotSupported": "Ваш браузер не поддерживает видео в формате HTML5.",
"GUI_DataRefreshed": "Успешно обновлено",

"Navigation_Logout": "Выйти",

"CheckIn_GetStarted": "Добавьте бота в чат для начала работы",
"CheckIn_DefaultLayerTitle": "Все",
Expand Down Expand Up @@ -235,14 +232,6 @@
"Dashboard_Apply": "Применить",
"Dashboard_SettingsApplied": "Настройки применены",
"Dashboard_DisableWidgetHelpTemplate": "Для включения виджета необходимо активировать функцию «{0}»",

"Footer_GroupNavigation": "Навигация",
"Footer_GroupTech": "Технологии",
"Footer_GroupStorage": "Хранилище",
"Footer_GroupTools": "Инструменты",
"Footer_LinkMain": "Главная",
"Footer_LinkConstructor": "Конструктор",
"Footer_LinkDashboard": "Дашборд",

"Login_AsSuperuserText": "Войти как суперпользователь",
"Login_Title": "Войти",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions src/Inc.TeamAssistant.WebUI/Features/Layouts/LayoutResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,28 @@
<data name="Login" xml:space="preserve">
<value>Login</value>
</data>
<data name="LinkMain" xml:space="preserve">
<value>Main</value>
</data>
<data name="GroupNavigation" xml:space="preserve">
<value>Navigation</value>
</data>
<data name="LinkConstructor" xml:space="preserve">
<value>Constructor</value>
</data>
<data name="LinkDashboard" xml:space="preserve">
<value>Dashboard</value>
</data>
<data name="GroupTech" xml:space="preserve">
<value>Tech</value>
</data>
<data name="GroupStorage" xml:space="preserve">
<value>Storage</value>
</data>
<data name="GroupTools" xml:space="preserve">
<value>Tools</value>
</data>
<data name="Logout" xml:space="preserve">
<value>Logout</value>
</data>
</root>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,28 @@
<data name="Login" xml:space="preserve">
<value>Войти</value>
</data>
<data name="LinkMain" xml:space="preserve">
<value>Главная</value>
</data>
<data name="GroupNavigation" xml:space="preserve">
<value>Навигация</value>
</data>
<data name="LinkConstructor" xml:space="preserve">
<value>Конструктор</value>
</data>
<data name="LinkDashboard" xml:space="preserve">
<value>Дашборд</value>
</data>
<data name="GroupTech" xml:space="preserve">
<value>Технологии</value>
</data>
<data name="GroupStorage" xml:space="preserve">
<value>Хранилище</value>
</data>
<data name="GroupTools" xml:space="preserve">
<value>Инструменты</value>
</data>
<data name="Logout" xml:space="preserve">
<value>Выйти</value>
</data>
</root>
120 changes: 65 additions & 55 deletions src/Inc.TeamAssistant.WebUI/Features/Layouts/MainFooter.razor
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
@inject IRenderContext RenderContext
@inject ResourcesManager Resources
@inject NavRouter NavRouter
@inject IStringLocalizer<LayoutResources> Localizer

<div class="footer">
<div class="footer__container">
<div class="footer__content">
@foreach (var group in _links)
{
<div class="footer-group">
<span class="footer-group__header">@group.Key</span>
@foreach (var link in group)
<span class="footer-group__header">@Localizer[group.Key].Value</span>
@foreach (var link in group.Value)
{
<RouterLink Href="@link.Url" Target="@(link.External ? RouterTarget.Blank : RouterTarget.Self)">
<Content>@link.Title</Content>
Expand All @@ -22,66 +22,76 @@
</div>

@code {
private ILookup<string, FooterLink> _links = Enumerable.Empty<FooterLink>().ToLookup(_ => string.Empty);
private IReadOnlyDictionary<string, IReadOnlyCollection<FooterLink>> _links = new Dictionary<string, IReadOnlyCollection<FooterLink>>();

protected override void OnInitialized() => Load();

private void Load()
{
const bool external = true;

var links = new (MessageId Key, FooterLink Value)[]
_links = new Dictionary<string, IReadOnlyCollection<FooterLink>>
{
(Messages.Footer_GroupNavigation, new FooterLink(
Resources[Messages.Footer_LinkMain],
NavRouter.CreateRoute(null),
!external)),
(Messages.Footer_GroupNavigation, new FooterLink(
Resources[Messages.Footer_LinkConstructor],
NavRouter.CreateRoute("constructor"),
!external)),
(Messages.Footer_GroupNavigation, new FooterLink(
Resources[Messages.Footer_LinkDashboard],
NavRouter.CreateRoute("dashboard"),
!external)),
(Messages.Footer_GroupTech, new FooterLink(
"DotNet",
"https://dotnet.microsoft.com/",
external)),
(Messages.Footer_GroupTech, new FooterLink(
"Blazor",
"https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor",
external)),
(Messages.Footer_GroupTech, new FooterLink(
"Nuke",
"https://nuke.build/",
external)),
(Messages.Footer_GroupStorage, new FooterLink(
"Postgres",
"https://www.postgresql.org/",
external)),
(Messages.Footer_GroupStorage, new FooterLink(
"Npgsql",
"https://www.npgsql.org/",
external)),
(Messages.Footer_GroupStorage, new FooterLink(
"FluentMigrator",
"https://fluentmigrator.github.io/",
external)),
(Messages.Footer_GroupTools, new FooterLink(
"Telegram.Bot",
"https://github.com/TelegramBots/Telegram.Bot",
external)),
(Messages.Footer_GroupTools, new FooterLink(
"FluentValidator",
"https://docs.fluentvalidation.net/",
external)),
(Messages.Footer_GroupTools, new FooterLink(
"GitHub",
"https://github.com/dyatlov-a/Inc.TeamAssistant",
external))
["GroupNavigation"] =
[
new FooterLink(
Localizer["LinkMain"],
NavRouter.CreateRoute(null),
!external),
new FooterLink(
Localizer["LinkConstructor"],
NavRouter.CreateRoute("constructor"),
!external),
new FooterLink(
Localizer["LinkDashboard"],
NavRouter.CreateRoute("dashboard"),
!external)
],
["GroupTech"] =
[
new FooterLink(
"DotNet",
"https://dotnet.microsoft.com/",
external),
new FooterLink(
"Blazor",
"https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor",
external),
new FooterLink(
"Nuke",
"https://nuke.build/",
external)
],
["GroupStorage"] =
[
new FooterLink(
"Postgres",
"https://www.postgresql.org/",
external),
new FooterLink(
"Npgsql",
"https://www.npgsql.org/",
external),
new FooterLink(
"FluentMigrator",
"https://fluentmigrator.github.io/",
external)
],
["GroupTools"] =
[
new FooterLink(
"Telegram.Bot",
"https://github.com/TelegramBots/Telegram.Bot",
external),
new FooterLink(
"FluentValidator",
"https://docs.fluentvalidation.net/",
external),
new FooterLink(
"GitHub",
"https://github.com/dyatlov-a/Inc.TeamAssistant",
external)
]
};

_links = links.ToLookup(i => Resources[i.Key], i => i.Value);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@implements IDisposable

@inject IRenderContext RenderContext
@inject ResourcesManager Resources
@inject NavRouter NavRouter
@inject IStringLocalizer<LayoutResources> Localizer

Expand Down Expand Up @@ -34,7 +33,7 @@
</span>
<div class="navbar__item">
<RouterLink Href="@_logoutUrl">
<Content>@Resources[Messages.Navigation_Logout]</Content>
<Content>@Localizer["Logout"].Value</Content>
</RouterLink>
</div>
</Authorized>
Expand Down
Loading

0 comments on commit e18b165

Please sign in to comment.