Pull request 2702: AGDNS-4218-fix-translation-scripts
Some checks failed
build / test (macOS-latest) (push) Has been cancelled
build / test (ubuntu-latest) (push) Has been cancelled
build / test (windows-latest) (push) Has been cancelled
lint / go-lint (push) Has been cancelled
lint / eslint (push) Has been cancelled
build / build-release (push) Has been cancelled
build / notify (push) Has been cancelled
lint / notify (push) Has been cancelled

Squashed commit of the following:

commit b4b41149e56fc657b7452ddc05feeeb9bc3fe913
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Fri Jul 10 19:08:47 2026 +0300

    scripts: imp note;

commit 1e3b636fd288832f67fea509ebea46269d6e07c2
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Fri Jul 10 19:07:24 2026 +0300

    scripts: move note to readme;

commit 23ba9336933ebb43e698e1f9da047ab5a87b7cd5
Author: Maksim Kazantsev <m.kazantsev@adguard.com>
Date:   Fri Jul 10 17:55:10 2026 +0300

    translations: fix scripts;
This commit is contained in:
Maksim Kazantsev 2026-07-10 16:21:47 +00:00
parent 206e77edb5
commit 3adfbb9f3d
3 changed files with 7 additions and 3 deletions

View file

@ -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": "العربية",

View file

@ -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.

View file

@ -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()