1
0

Move root path out from CurrentPath() func and localise it.

This commit is contained in:
Alexander Andreev 2024-12-27 16:31:16 +04:00
parent edd1d9f16d
commit c63d59f0a4
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
4 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,6 @@ import (
func CurrentPath(path string) (curPath string) { func CurrentPath(path string) (curPath string) {
parts := strings.Split(path, "/")[1:] parts := strings.Split(path, "/")[1:]
curPath = "<a href=\"/\">root</a>"
for i, part := range parts { for i, part := range parts {
var sb strings.Builder var sb strings.Builder
sb.WriteString("/<a href=\"/") sb.WriteString("/<a href=\"/")

View File

@ -39,7 +39,7 @@ templ Index(currentPath, progVer string, stat *files.DirStat, entries *[]files.D
</header> </header>
<main> <main>
<section> <section>
<span>@templ.Raw(currentPath)</span> <span><a href="/">{ i18n.T(ctx, "curpath-root") }</a>@templ.Raw(currentPath)</span>
<p>{ i18n.T(ctx, "stats.files") }: { strconv.FormatInt(stat.Files, 10) } ({ stat.FilesSize }); { i18n.T(ctx, "stats.directories") }: { strconv.FormatInt(stat.Directories, 10) }.</p> <p>{ i18n.T(ctx, "stats.files") }: { strconv.FormatInt(stat.Files, 10) } ({ stat.FilesSize }); { i18n.T(ctx, "stats.directories") }: { strconv.FormatInt(stat.Directories, 10) }.</p>
<input type="text" name="filter" placeholder={ i18n.T(ctx, "stats.filter") } class="hidden"> <input type="text" name="filter" placeholder={ i18n.T(ctx, "stats.filter") } class="hidden">
</section> </section>

View File

@ -3,6 +3,7 @@ en:
description: My file share description: My file share
keywords: files ftp share self-host keywords: files ftp share self-host
back-home: Back home back-home: Back home
curpath-root: root
stats: stats:
files: Files files: Files
directories: Directories directories: Directories

View File

@ -3,6 +3,7 @@ ru:
description: Моя файловая шара description: Моя файловая шара
keywords: файлы шара ftp селф-хост само-хост self-host keywords: файлы шара ftp селф-хост само-хост self-host
back-home: Назад домой back-home: Назад домой
curpath-root: корень
stats: stats:
files: Файлы files: Файлы
directories: Директории directories: Директории