From 8948fdbdccebd65a00f581699f788ff68a4bd69c Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Sun, 19 Jan 2025 18:50:24 +0300 Subject: [PATCH] FEATURE: i18n system!; Russian language added --- Makefile | 6 ++ pages/about.html | 6 +- pages/base.html | 43 ++++++++++- pages/category.html | 74 +++++++++--------- pages/error.html | 6 +- pages/index.html | 10 +-- pages/login.html | 7 +- pages/register.html | 16 ++-- src/i18n/i18n.go | 55 ++++++++++++++ src/i18n/page.go | 16 ++++ src/server/page.go | 33 ++++++++ src/server/server.go | 47 ++++++++++-- src/server/validation.go | 23 ++++++ static/images/globe.svg | 3 + static/images/paint-bucket.svg | 3 + translations/eng/about.json | 20 +++++ translations/eng/base.json | 25 ++++++ translations/eng/category.json | 135 +++++++++++++++++++++++++++++++++ translations/eng/error.json | 20 +++++ translations/eng/index.json | 20 +++++ translations/eng/login.json | 20 +++++ translations/eng/paint.json | 1 + translations/eng/register.json | 50 ++++++++++++ translations/ru/about.json | 20 +++++ translations/ru/base.json | 25 ++++++ translations/ru/category.json | 135 +++++++++++++++++++++++++++++++++ translations/ru/error.json | 20 +++++ translations/ru/index.json | 20 +++++ translations/ru/login.json | 15 ++++ translations/ru/paint.json | 1 + translations/ru/register.json | 50 ++++++++++++ 31 files changed, 855 insertions(+), 70 deletions(-) create mode 100644 src/i18n/i18n.go create mode 100644 src/i18n/page.go create mode 100644 static/images/globe.svg create mode 100644 static/images/paint-bucket.svg create mode 100644 translations/eng/about.json create mode 100644 translations/eng/base.json create mode 100644 translations/eng/category.json create mode 100644 translations/eng/error.json create mode 100644 translations/eng/index.json create mode 100644 translations/eng/login.json create mode 100644 translations/eng/paint.json create mode 100644 translations/eng/register.json create mode 100644 translations/ru/about.json create mode 100644 translations/ru/base.json create mode 100644 translations/ru/category.json create mode 100644 translations/ru/error.json create mode 100644 translations/ru/index.json create mode 100644 translations/ru/login.json create mode 100644 translations/ru/paint.json create mode 100644 translations/ru/register.json diff --git a/Makefile b/Makefile index 4780dbc..d751527 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ all: savedb clean cd .. && \ cp -r pages bin && \ cp -r scripts bin && \ + cp -r translations bin && \ cp -r static bin -mv dela.db bin/ @@ -19,6 +20,7 @@ cross: clean mkdir -p bin/dela_linux_x64 cp -r pages bin/dela_linux_x64 cp -r scripts bin/dela_linux_x64 + cp -r translations bin/dela_linux_x64 cp -r static bin/dela_linux_x64 cp COPYING bin/dela_linux_x64 cp README.md bin/dela_linux_x64 @@ -26,6 +28,7 @@ cross: clean mkdir -p bin/dela_windows_x64 cp -r pages bin/dela_windows_x64 cp -r scripts bin/dela_windows_x64 + cp -r translations bin/dela_windows_x64 cp -r static bin/dela_windows_x64 cp COPYING bin/dela_windows_x64 cp README.md bin/dela_windows_x64 @@ -33,6 +36,7 @@ cross: clean mkdir -p bin/dela_darwin_x64 cp -r pages bin/dela_darwin_x64 cp -r scripts bin/dela_darwin_x64 + cp -r translations bin/dela_darwin_x64 cp -r static bin/dela_darwin_x64 cp COPYING bin/dela_darwin_x64 cp README.md bin/dela_darwin_x64 @@ -40,6 +44,7 @@ cross: clean mkdir -p bin/dela_darwin_arm64 cp -r pages bin/dela_darwin_arm64 cp -r scripts bin/dela_darwin_arm64 + cp -r translations bin/dela_darwin_arm64 cp -r static bin/dela_darwin_arm64 cp COPYING bin/dela_darwin_arm64 cp README.md bin/dela_darwin_arm64 @@ -47,6 +52,7 @@ cross: clean mkdir -p bin/dela_freebsd_x64 cp -r pages bin/dela_freebsd_x64 cp -r scripts bin/dela_freebsd_x64 + cp -r translations bin/dela_freebsd_x64 cp -r static bin/dela_freebsd_x64 cp COPYING bin/dela_freebsd_x64 cp README.md bin/dela_freebsd_x64 diff --git a/pages/about.html b/pages/about.html index 9ca764d..50e0b8b 100644 --- a/pages/about.html +++ b/pages/about.html @@ -6,10 +6,10 @@

Dela

-

a dead simple and minimalistic web TODO list

+

{{index .Translation "about info"}}

diff --git a/pages/base.html b/pages/base.html index 74f95cb..b379873 100644 --- a/pages/base.html +++ b/pages/base.html @@ -30,18 +30,22 @@
+
@@ -58,6 +62,32 @@