# i18n

URL: /kida/api/analysis/i18n/
Section: analysis
Description: Message extraction for i18n support.

Walks the AST and collects translatable strings from ``Trans`` nodes
and ``_()`` / ``_n()`` function calls.  Outputs structured messages
suitable for PO template generation or Babel integration.

---

> For a complete page index, fetch /kida/llms.txt.

Open LLM text
(/kida/api/analysis/i18n/index.txt)

Share with AI

Ask Claude
(https://claude.ai/new?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Fi18n%2Findex.txt)

Ask ChatGPT
(https://chatgpt.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Fi18n%2Findex.txt)

Ask Gemini
(https://gemini.google.com/app?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Fi18n%2Findex.txt)

Ask Copilot
(https://copilot.microsoft.com/?q=Please%20help%20me%20understand%20this%20documentation%3A%20%2Fkida%2Fapi%2Fanalysis%2Fi18n%2Findex.txt)

Module

#
`analysis.i18n`

Message extraction for i18n support.

Walks the AST and collects translatable strings from`Trans`nodes
and`_()` / `_n()`function calls. Outputs structured messages
suitable for PO template generation or Babel integration.

2Classes

## Classes

`ExtractedMessage`

5

▼

A translatable message extracted from a template.

A translatable message extracted from a template.

#### Attributes

Name
Type
Description

`filename`

`str`

—

`lineno`

`int`

—

`function`

`str`

—

`message`

`str | tuple[str, str]`

—

`comments`

`tuple[str, ...]`

—

`ExtractMessagesVisitor`

4

▼

Walk AST and collect translatable messages.

Collects messages from:

- ``Trans`` nodes (``{% trans…

Walk AST and collect translatable messages.

Collects messages from:

- `Trans` nodes (`{% trans %}...{% endtrans %}`)

- `FuncCall` nodes calling `_()` or `_n()`

#### Methods

`extract`

1

`list[ExtractedMessage]`

▼

Extract all translatable messages from an AST.

`def extract(self, node: Node) -> list[ExtractedMessage]`

##### Parameters

Name
Type
Description

`node`
`—`

##### Returns

`list[ExtractedMessage]`

`visit_Trans`

1

▼

Extract message from ``{% trans %}`` block.

`def visit_Trans(self, node: Trans) -> None`

##### Parameters

Name
Type
Description

`node`
`—`

`visit_FuncCall`

1

▼

Extract message from ``_("literal")`` or ``_n("s", "p", n)`` calls.

`def visit_FuncCall(self, node: FuncCall) -> None`

##### Parameters

Name
Type
Description

`node`
`—`

Internal Methods
1

▼

`__init__`

1

▼

`def __init__(self, filename: str = '<template>') -> None`

##### Parameters

Name
Type
Description

`filename`
`—`

Default:`'<template>'`
