From 3adfbb9f3dc10aea909c2d963a9250fbefc96ee1 Mon Sep 17 00:00:00 2001 From: Maksim Kazantsev Date: Fri, 10 Jul 2026 16:21:47 +0000 Subject: [PATCH] Pull request 2702: AGDNS-4218-fix-translation-scripts Squashed commit of the following: commit b4b41149e56fc657b7452ddc05feeeb9bc3fe913 Author: Maksim Kazantsev Date: Fri Jul 10 19:08:47 2026 +0300 scripts: imp note; commit 1e3b636fd288832f67fea509ebea46269d6e07c2 Author: Maksim Kazantsev Date: Fri Jul 10 19:07:24 2026 +0300 scripts: move note to readme; commit 23ba9336933ebb43e698e1f9da047ab5a87b7cd5 Author: Maksim Kazantsev Date: Fri Jul 10 17:55:10 2026 +0300 translations: fix scripts; --- .twosky.json | 2 +- scripts/README.md | 3 +++ scripts/translations/main.go | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.twosky.json b/.twosky.json index 7a40c489259..e9658055df0 100644 --- a/.twosky.json +++ b/.twosky.json @@ -52,7 +52,7 @@ "project_id": "hostlists-registry", "base_locale": "en", "localizable_files": [ - "client/src/__locales-services/services.json" + "client/src/__locales-services/en.json" ], "languages": { "ar": "العربية", diff --git a/scripts/README.md b/scripts/README.md index a06edb2119f..215eb1c5f39 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -202,6 +202,9 @@ Optional environment: - `go run ./scripts/translations summary`: show the current locales summary. + > [!NOTE] + > The following script may produce false positives because JavaScript uses template literals like `servicesgroup.${group.id}.name`, so the actual key won't be found by substring search. + - `go run ./scripts/translations unused`: show the list of unused strings. - `go run ./scripts/translations auto-add`: add locales with additions to the git and restore locales with deletions. diff --git a/scripts/translations/main.go b/scripts/translations/main.go index 71a272b9a0d..ce466c62aae 100644 --- a/scripts/translations/main.go +++ b/scripts/translations/main.go @@ -60,8 +60,9 @@ type languages map[langCode]string // textlabel is a text label of localization. type textLabel string -// locales is a map, where key is text label and value is translation. -type locales map[textLabel]string +// locales is a map, where key is a text label and the value is either a string +// or an object. +type locales map[textLabel]any func main() { ctx := context.Background()