Add i18n framework with English and Chinese support
Introduce an embedded-locale i18n package exposing a T() template function. UI strings across all templates and catalog category/item names are now translatable via locale JSON files, selectable through the new server.language config option. Falls back to English when a locale is missing or fails to load. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
1 parent
5e82e32491
commit
ff1d1fc490
16 files changed
+1161
-318
No files matched your search
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="{{.Lang}}">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{block "title" .}}Solis | Home Assets{{end}}</title>
|
||||
<title>{{block "title" .}}{{T "app.title"}}{{end}}</title>
|
||||
|
||||
<!-- Dynamic CSRF Metadata for HTMX requests -->
|
||||
<meta name="csrf-token" content="{{.CSRFToken}}">
|
||||
@@ -32,7 +32,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z" />
|
||||
</svg>
|
||||
Assets
|
||||
{{T "nav.assets"}}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item {{if eq .ActiveNav "locations"}}active{{end}}">
|
||||
@@ -41,7 +41,7 @@
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15 10.5a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25s-7.5-4.108-7.5-11.25" />
|
||||
</svg>
|
||||
Locations
|
||||
{{T "nav.locations"}}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item {{if eq .ActiveNav "tags"}}active{{end}}">
|
||||
@@ -50,7 +50,7 @@
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9.568 3H5.25A2.25 2.25 0 003 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581a1.125 1.125 0 001.591 0l4.318-4.318a1.125 1.125 0 000-1.591l-9.581-9.581A2.25 2.25 0 009.568 3z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6 6h.008v.008H6V6z" />
|
||||
</svg>
|
||||
Tags
|
||||
{{T "nav.tags"}}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item {{if eq .ActiveNav "shortener"}}active{{end}}">
|
||||
@@ -58,7 +58,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244" />
|
||||
</svg>
|
||||
Shortlinks
|
||||
{{T "nav.shortlinks"}}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item {{if eq .ActiveNav "print"}}active{{end}}">
|
||||
@@ -66,7 +66,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0a2.25 2.25 0 01-2.247 2.118H8.587A2.25 2.25 0 016.34 18m11.32 0h.008v.008h-.008V18zm-12 0h.008v.008H5.66V18zm0-11.25h12.75c.621 0 1.125.504 1.125 1.125v1.5c0 .621-.504 1.125-1.125 1.125H5.66c-.621 0-1.125-.504-1.125-1.125v-1.5c0-.621.504-1.125 1.125-1.125z" />
|
||||
</svg>
|
||||
Print Labels
|
||||
{{T "nav.print_labels"}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -80,7 +80,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" style="width:16px;height:16px;margin-right:4px;">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 9V5.25A2.25 2.25 0 0013.5 3h-6a2.25 2.25 0 00-2.25 2.25v13.5A2.25 2.25 0 007.5 21h6a2.25 2.25 0 002.25-2.25V15M12 9l-3 3m0 0l3 3m-3-3h12.75" />
|
||||
</svg>
|
||||
Sign Out
|
||||
{{T "nav.sign_out"}}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
@@ -97,7 +97,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" style="width: 16px; height: 16px; margin-right: 4px;">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z" />
|
||||
</svg>
|
||||
Admin Login
|
||||
{{T "nav.admin_login"}}
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
@@ -123,10 +123,10 @@
|
||||
<div id="qr-modal-overlay" style="display:none; position:fixed; inset:0; z-index:9999; background:rgba(0,0,0,0.55); backdrop-filter:blur(4px); justify-content:center; align-items:center;">
|
||||
<div id="qr-modal-card" style="background:var(--color-bg-surface, #fff); border-radius:16px; padding:2.5rem 2rem 2rem; max-width:380px; width:90%; box-shadow:0 24px 48px -12px rgba(0,0,0,0.25); display:flex; flex-direction:column; align-items:center; gap:1.25rem; position:relative; animation:qrModalIn 0.25s cubic-bezier(0.16,1,0.3,1);">
|
||||
<button onclick="closeQRModal()" style="position:absolute; top:0.75rem; right:0.75rem; background:none; border:none; font-size:1.5rem; cursor:pointer; color:var(--color-text-light); line-height:1;" aria-label="Close">×</button>
|
||||
<h3 style="font-weight:700; font-size:1.15rem; color:var(--color-text-main); margin:0;">QR Code Preview</h3>
|
||||
<h3 style="font-weight:700; font-size:1.15rem; color:var(--color-text-main); margin:0;">{{T "qr.preview"}}</h3>
|
||||
<img id="qr-modal-image" src="" alt="QR Code" style="width:220px; height:220px; border:1px solid var(--color-border); border-radius:8px; background:#fff; padding:8px;">
|
||||
<code id="qr-modal-link" style="font-family:monospace; background:var(--color-bg-base, #f5f5f5); padding:0.4rem 0.85rem; border-radius:6px; border:1px solid var(--color-border); font-weight:600; font-size:0.95rem; word-break:break-all; text-align:center;"></code>
|
||||
<a id="qr-modal-download" download="" href="" class="btn btn-primary" style="width:100%; font-size:0.9rem; text-align:center;">Download QR Image</a>
|
||||
<a id="qr-modal-download" download="" href="" class="btn btn-primary" style="width:100%; font-size:0.9rem; text-align:center;">{{T "qr.download"}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
|
||||
Reference in new issue
Block a user