mix gettext_ts.extract (gettext_ts v0.2.0)

Copy Markdown View Source

Extracts t("...") msgids from frontend TypeScript/TSX files into the default domain's POT, then runs mix gettext.merge so every locale's PO picks them up.

Both call shapes are recognized: t("msgid") (default domain) and t("domain", "msgid"). Globs, function name and ignore rules come from config (see GettextTs).

A third shape carries the domain in the BINDING rather than the call:

const tp = useT("admin");
tp("Participant list");

Every const|let|var <name> = useT("<domain>") in a file is picked up, and calls through that name are attributed to that domain. Without it a file that switched to a non-default domain would keep extracting into the default one — silently, since the msgid still lands in A catalog and the drift only shows as untranslated copy at runtime. The hook name is :domain_hook (default "useT", the name the React emitter generates).

mix gettext_ts.extract             # scan + POT + merge
mix gettext_ts.extract --dry-run   # show findings only
mix gettext_ts.extract --no-merge  # skip gettext.merge (tests/CI)