Skip to main content

ALToolbox

PyPI version

This repository is used to host small Python modules, widgets, and JavaScript web components js files that enhance Docassemble interviews. These modules were built as part of the Suffolk University Law School LIT Lab's Document Assembly Line project. They are placed here rather than in https://github.com/SuffolkLitLab/docassemble-AssemblyLine because we believe these small components can easily be used by anyone, regardless of whether they use any other code from the Document Assembly Line project.

If you want to add a small function to this project, consider adding it to the existing misc.py to avoid creating too many module files.

Documentation

Read the documentation for the functions and components to learn how to use these components in your own Docassemble projects.

Translating strings inside JavaScript

Docassemble translates anything that reaches Python through word(), but JavaScript running in the browser has no way to reach that catalog, so strings in custom datatypes and small widgets tend to stay hardcoded in English.

ALToolbox adds an endpoint, /al_translations.json?lang=es, that returns the word() catalog for a language, and a script that puts it behind _():

include:
  - docassemble.ALToolbox:translation_strings.yml

Then, in your JavaScript:

_("Copied!")                                  // "¡Copiado!"
_("You have entered %d characters.", count)   // "Ha escrito 42 caracteres."
_("%1$s of %2$s", done, total)                // positional, so a translation can reorder
_("100%% sure")                               // "%%" is a literal percent sign

alTranslate() is the same function under a less collision-prone name. _ is only assigned if nothing else has claimed it, so an interview that loads lodash or underscore keeps its own _.

Adding translations

Write a word translation file and list it under words: in your server configuration — the same mechanism docassemble already uses for word():

# docassemble/yourpackage/data/sources/yourpackage_words.yml
es:
  Copied!: ¡Copiado!
  You have entered %d characters.: Ha escrito %d caracteres.
# in the docassemble configuration
words:
  - docassemble.ALToolbox:data/sources/altoolbox_words.yml
  - docassemble.yourpackage:data/sources/yourpackage_words.yml

For translations that come from somewhere other than a file, add_translations() adds them to the same catalog at runtime:

code: |
  add_translations("es", {"Copied!": "¡Copiado!"})

Lookups try an exact match first, then one that ignores surrounding whitespace, capitalization and trailing punctuation, restoring the source string's capitalization and punctuation on the way out. So a catalog entry for copied will still translate _("Copied!").

What to expect

The catalog is fetched once and kept in localStorage, keyed by language, so _() resolves synchronously on every page load after the first. On the very first load of a language the catalog is still in flight and _() returns the English source; listen for the alTranslationsLoaded event on window if you need to redraw when it arrives.

Docassemble loads every script at the end of the body, so _ exists from daPageLoad onward — which is where interview JavaScript normally does its work anyway. An inline <script> in a subquestion runs before that, so wrap it:

document.addEventListener("DOMContentLoaded", function () {
  document.getElementById("greeting").textContent = _("Hello");
});

The endpoint is unauthenticated and identical for every user of a language — it exposes the server's configured word() catalog for that language (which may include arbitrary

phrases from installed packages). translation_strings.translate() is

Run translation_strings_demo.yml to see it working.

Suffolk LIT Lab Document Assembly Line

drawing of people working together on a website UI

The Assembly Line Project is a collection of volunteers, students, and institutions who joined together during the COVID-19 pandemic to help increase access to the court system. Our vision is mobile-friendly, easy to use guided online forms that help empower litigants to access the court remotely.

Our signature project is CourtFormsOnline.org.

We designed a step-by-step, assembly line style process for automating court forms on top of Docassemble and built several tools along the way that you can use in your home jurisdiction.

This package contains runtime code and pre-written questions to support authoring robust, consistent, and attractive Docassemble interviews that help complete court forms.

Read more on our documentation page.

Contributors:

  • @plocket
  • @nonprofittechy
  • @purplesky2016
  • @brycestevenwilley

Metadata

Release files for docassemble.ALToolbox 0.19.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docassemble.ALToolbox 0.19.2
File Size Uploaded Provenance Actions
docassemble_altoolbox-0.19.2.tar.gz 379.2 kB With provenance Details for docassemble_altoolbox-0.19.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docassemble.ALToolbox 0.19.2
File Interpreter ABI Platform Actions
docassemble_altoolbox-0.19.2-py3-none-any.whl Python 3 none any Details for docassemble_altoolbox-0.19.2-py3-none-any.whl

Total release size: 799.5 kB

Release files / docassemble_altoolbox-0.19.2.tar.gz

Download URL docassemble_altoolbox-0.19.2.tar.gz
Size 379.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6800fa1798e158e15a504fffe5bfa94bccb5186809fabc48a51d58e20709097a
BLAKE2b-256 checksum
How to use checksums
a32f14737daba1fae0ad33433315653694e1343096bc98ac0361c5c66c8bb745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / docassemble_altoolbox-0.19.2-py3-none-any.whl

Download URL docassemble_altoolbox-0.19.2-py3-none-any.whl
Size 420.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b62a420ea071a788a06c3013d02a3a1a2209724af34432eb2f14cc9de18e946
BLAKE2b-256 checksum
How to use checksums
1ea981ae17d47ae74482cae46b739913ca361c246f2a02466da5fb939048ea2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for docassemble.ALToolbox 0.19.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for docassemble_altoolbox-0.19.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.19.2 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page