Skip to content

v0.5.2: a hardening release

Choose a tag to compare

@DABH DABH released this 29 Sep 01:32
· 19 commits to main since this release

A hardening release from a full review of the runtime, the Action and the Python package. English output is unchanged; catalogs need no migration.

Go runtime

  • Help texts spanning several lines (Cobra's completion --help, for one) are matched as a whole before line splitting, so they render correctly in every built-in language.
  • Placeholder captures are checked before they're translated again: prose no longer gets spliced into translations in error output, %w/%v captures are exempt, and a capture that ends a sentence is left alone in help.
  • Fails open everywhere: a panic in Init, Localize, a help or usage hook or a writer falls back to the original behavior, and a translated template that doesn't parse is never installed.
  • Commands with their own help or usage function are wrapped too; flag deprecation notices are translated; the completion walk skips DisableFlagParsing commands.
  • Validation: an unterminated {{, bidi isolates and overrides and other formatting controls, a \r the source doesn't have, or a changed first backquoted span make an entry invalid; 50% off-style space-flag verbs are prose.
  • The memo cache is bounded (1 MiB, entries up to 1 KiB).
  • New API: Translate(s, mode) with ModeOutput, ModeHelp, ModeError, and Reset() for tests.
  • macOS: the preferences plist parser is bounds-checked and only reads regular files up to 8 MiB. catalog.ParseFast matches encoding/json exactly (surrogates, trailing data, duplicate keys).
  • LOCALIZER_DUMP creates its file exclusively and is ignored for root and setuid processes.

Python runtime

  • Matching is bounded (no regex backtracking on large outputs), Rich tags are validated as an ordered, balanced sequence, and Typer/Click rendering fails open to the English help.
  • Multi-line docstring help is translated on Python 3.12 and older; Typer's bundled Click gets translated prompt and confirmation messages; state is restored per render and safe across threads and a second localize().
  • localize(language="") auto-detects; t() falls back to a pattern translation.
  • Packaging: a dev dependency group, the built wheel is tested in CI on Python 3.11–3.13 and Typer 0.26; the alias README documents the upgrade from localizer-py.

GitHub Action and workflows

  • The Action writes only allowlisted paths (never .git or .github components), adopts only pull requests from the same repository, pushes with the github-token input, and retries its polling.
  • Third-party actions are pinned by SHA; releases are published only from tags whose commit is on main and whose tests passed.

Docs

  • Precise wording on what is and isn't translated, on human edits and invalid entries, the language lookup order, LOCALIZER_DEBUG, the .localizer.yml validation rules and the service's subprocessors, plus the Action snippets pinned to this release (pull request #18).

The conformance corpus (shared by both runtimes) gained Go-syntax placeholder vectors, round-trip vectors and engine cases with built-in catalogs.