# i18n

URL: /kida/api/parser/blocks/i18n/
Section: blocks
Description: i18n block parsing for Kida parser.

Provides mixin for parsing {% trans %} blocks with variable bindings,
pluralization via {% plural %}, and message ID extraction.

Uses inline TYPE_CHECKING declarations for host attributes.
See: plan/rfc-mixin-protocol-typing.md

---

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

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

Share with AI

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

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

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

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

Module

#
`parser.blocks.i18n`

i18n block parsing for Kida parser.

Provides mixin for parsing {% trans %} blocks with variable bindings,
pluralization via {% plural %}, and message ID extraction.

Uses inline TYPE_CHECKING declarations for host attributes.
See: plan/rfc-mixin-protocol-typing.md

1Class

## Classes

`I18nParsingMixin`

3

▼

Mixin for parsing {% trans %}...{% endtrans %} blocks.

Host attributes and cross-mixin dependencie…

Mixin for parsing {% trans %}...{% endtrans %} blocks.

Host attributes and cross-mixin dependencies are declared via inline
TYPE_CHECKING blocks.

#### Methods

Internal Methods
3

▼

`_parse_trans`

0

`Trans`

▼

Parse {% trans [var=expr, ...] %}...{% endtrans %}.

Syntax:
{% trans %}lit…

`def _parse_trans(self) -> Trans`

Parse {% trans [var=expr, ...] %}...{% endtrans %}.

Syntax:

```
{% trans %}literal body{% endtrans %}
{% trans name=expr %}Hello, {{ name }}!{% endtrans %}
{% trans count=expr %}One item.{% plural %}{{ count }} items.{% endtrans %}
```

Body restrictions:

- Only {{ name }} references allowed (simple names)

- No filters, attribute access, or method calls

- All referenced names must be declared in the {% trans %} tag

##### Returns

`Trans`

`_parse_trans_body`

1

`tuple[list[str], list[st…`

▼

Parse trans block body, returning singular parts, plural parts, and has_plural …

`def _parse_trans_body(self, declared_names: set[str]) -> tuple[list[str], list[str], bool]`

Parse trans block body, returning singular parts, plural parts, and has_plural flag.

##### Parameters

Name
Type
Description

`declared_names`
`—`

##### Returns

`tuple[list[str], list[str], bool]`

`_normalize_message`

1

`str`

▼

Normalize whitespace in a message ID.

Strips leading/trailing whitespace and c…

staticmethod

`def _normalize_message(msg: str) -> str`

Normalize whitespace in a message ID.

Strips leading/trailing whitespace and collapses internal
whitespace to single spaces. This ensures consistent message
IDs regardless of template formatting.

##### Parameters

Name
Type
Description

`msg`
`—`

##### Returns

`str`
