Skip to content
ERPForAll DocsDevelopment

    Localization pack format

    A localization pack is data for one or more countries (a chart of accounts, taxes, dated rates) shipped inside an ordinary addon directory (ADR 0047). It has no code. The addon’s manifest.toml stays the only place for dependencies, the package version and requested capabilities; pack.toml describes the data. A runnable example, also used by the tests, is crates/erp-modules/tests/fixtures/pack_sample/.

    Staging (erp_modules::pack::PackRegistry::stage_dir) reads local files only, checks the whole pack, and registers the release or refuses the first problem. A refusal names the file, the position inside it and the rule, for example data/accounts.csv: row 2.mystery: [unknown-field] Unknown pack field mystery.. Staging does not activate a chart for a company; that is a separate step.

    KeyRule
    format_version1. Another value is refused naming the version found and the supported set.
    pack_id, profile_idLower-case dotted names; the profile id starts with the pack id.
    rule_release_idImmutable id of this release, 1 to 64 characters. The same id with other bytes is refused.
    pack_versionThe pack’s own version, a positive integer. A new release of the pack must be greater.
    release_dateYYYY-MM-DD. A new release may not be dated earlier than the previous one.
    jurisdictionsISO 3166 alpha-2 codes.
    [schemas]Model name to the SHA-256 of the offline schema the pack was written against. A model the pack uses must be listed; a wrong hash is refused. Nothing is fetched from a URL.
    [[files]]path, sha256 of the bytes, kind (records or translations), model (the model of a record file: required for CSV, the default for TOML records). Every declared file must exist and match its digest.
    [dependencies."other.pack"]release and sha256 of a staged release of another pack (see “Packs that build on other packs”).
    [[template]]key, optional country (an ISO 3166 alpha-2 code that is one of the pack’s jurisdictions; any other value is refused as jurisdiction at template[i].country), optional parent and code_digits (see “Child templates”), and files. Every file belongs to exactly one template.

    Paths are relative and stay inside the pack: .., absolute paths, backslashes, symbolic links, hard links and URLs are refused. A path has one spelling: an empty or . component (data//a.toml, data/./a.toml, a leading or trailing slash) is refused where the file is declared, so two spellings of one file cannot both pass the duplicate check. The profile_id is the pack_id or the pack_id, a dot and more (example.sample.generic, not example.samplex).

    Records are TOML tables. A record is identified by the pack, its template, its model and its key; names and codes are values, never identity.

    [[record]]
    model = "example.tax"
    key = "vat_std"
    [record.fields]
    name = "Standard rate"
    account = "sales" # a reference: key of a record of the schema's model
    rate = "decimal:10.0 percent" # exact values carry a tag and a unit
    factor = "ratio:11/12 factor"
    • Exact values are decimal:<n> <unit> (at most 29 coefficient digits and scale 28, the ADR 0046 range) or ratio:<n>/<d> <unit> (positive denominator, at most 1232 digits). A TOML float or number, or a string without a tag, is refused. Stored decimals are canonical (-000.500 becomes -0.5).
    • Dates are 2026-01-01 (TOML dates or text). There is no “today”: nothing reads the clock.
    • References are the key of a record of the schema’s model in the same template. An unresolved reference is refused.

    A records file ending in .csv is a flat table of one model (the model of its [[files]] entry). The first row names the columns: key, the fields of the model, and optionally template and tombstone (true, false or empty). Every row has as many cells as the header.

    key,name,code,note
    petty,Petty cash,15,
    card,Card,16,Card payments
    • A cell is typed by the schema field: text, integer, true or false, a date, an exact decimal: or ratio: value, or a reference (key, or other.pack/key).
    • An empty cell of a new record is an empty string for a text field and null for a nullable field of another type; an empty cell of a required field that is not text is refused (“Required pack field rate is empty.”). The empty cells of a tombstone row are ignored. A TOML row that gives "" for a required text field is refused the same way (“Required pack field name is missing.”).
    • An empty cell of a row that overrides an inherited record is refused (“Empty override cell note requires clear_fields or an explicit typed value.”): omission inherits, so state a value, or clear the field in a TOML record with clear_fields.
    • A repeated or empty column name is refused. A column the model does not have is refused (“Unknown pack field”).

    Everything of the Odoo source CSV that carries meaning outside the cell is refused with one message, “Source CSV grammar is not accepted at runtime; use the offline localization converter.”: a row with no key (a continuation row), a column name with a slash (account_id/id) or @lang, and a reference cell that is a comma list or a command tuple such as (6,0,[1]). Nested relations and translations are separate keyed rows.

    A file of kind = "translations" is a CSV with exactly the columns model,key,field,lang,text: one row per record, text field and language.

    model,key,field,lang,text
    example.account,cash,name,fr,Caisse
    example.account,cash,name,pt_BR,Caixa

    The record must exist in the template (own or inherited), the field must be a text field of its model, lang is a language code (fr, pt_BR), text may not be empty, and a (model, key, field, lang) appears once. The label of a record is never a lookup key. A child template inherits the translations of its parent, can translate again (its own row replaces the inherited one), and loses the translations of a record it removes. They are read from TemplateData::translations. A translation file belongs to a template like any other file.

    A pack names the releases of other packs it uses and pins each by digest:

    [dependencies."example.sample"]
    release = "R1"
    sha256 = "<digest of the staged release, Pack::digest>"
    [[template]]
    key = "local"
    parent = "example.sample/chart" # a template of the pinned release
    files = ["data/local.toml"]
    • Parents and qualified references (example.sample/sales) resolve in the pinned release only; a newer release of the other pack is never substituted. A release that is not staged yet is refused (“Unresolved or undeclared pack reference …”); a staged release with another digest is refused (digest-mismatch, path dependencies.example.sample). Stage the other pack first.
    • The child inherits the parent’s effective records, translations and code_digits; the models of inherited records need not be declared again in [schemas]. Record::template keeps naming the template that defined a record.
    • A reference to a pack that is not a declared dependency is refused. A reference qualified with the pack’s own id is a local one.
    • A pack never edits a template of another pack: a record row naming one is refused (“cannot extend template … in place; declare a child template”).
    • The addon dependency that makes the other pack’s addon load first is the manifest’s, as always; this table pins the data release.

    A template may name a parent: the key of another template of the same pack (or this.pack/key). Parents are resolved root first. The child starts from the parent’s effective records and its own file rows override them by (model, key): a field the row names replaces the inherited value, a field it leaves out is inherited. A pack never edits a template it does not own: a row whose template names another template is refused with “cannot extend template … in place; declare a child template”.

    pack.toml
    [[template]]
    key = "chart_child"
    parent = "chart"
    files = ["data/child.toml"]
    data/child.toml
    [[record]] # override: the name changes, the code is inherited
    model = "example.account"
    key = "bank"
    [record.fields]
    name = "Current account"
    [[record]] # clear: the nullable field becomes null (Value::Null)
    model = "example.account"
    key = "cash"
    clear_fields = ["note"]
    [[record]] # tombstone: the inherited record is removed from this template and its children
    model = "example.account"
    key = "misc"
    tombstone = true
    • Clearing. Omission inherits; clear_fields stores null and only a nullable field of an inherited record can be cleared. Clearing a field and giving it a value in the same row is refused, and so is clearing a non-nullable field. To override text with an empty string write the typed value note = ""; an empty string never means null.
    • Tombstones. A tombstone must name an inherited record and carries no fields. The removed keys are listed in TemplateData::tombstones for the activation step to evaluate; a record that still points at a removed record is refused as an unresolved reference. A later child may add the key again.
    • Depth and cycles. A parent chain longer than l10n.pack.max_parent_depth is refused (“Template parent depth exceeds configured limit.”), and a loop is refused with the chain (“Template parent cycle: a -> b -> a.”).
    • Identity. An effective record keeps its model and key; Record::template says which template defined or last overrode it. Child collections match by key, never by position.

    A parent in another pack is declared in [dependencies] (see “Packs that build on other packs”).

    code_digits on a template (a child inherits it, or sets its own) pads the code of every record whose model schema names a code_field, the way the reference charts do: zeros are added on the right (12 becomes 1200), so an account keeps its class. Only active accounts are padded: a record whose schema active_field is false keeps its code as written (such accounts are usually parents). A code longer than the width stays as it is: nothing is truncated and nothing is refused for length. Two codes that are equal after padding are refused (“Account code 1200 collides in root chart.”); the record key, not the code, stays its identity, and nothing matches by prefix. code_digits = 0 is refused, and so is a width above l10n.pack.max_code_digits (before any padding). A template without code_digits keeps its codes as written. The name after root in the collision message is the root template of the parent chain, which owns one code space. A child that sets a wider code_digits pads the inherited codes again to the new width.

    A model whose schema declares scope fields is dated: each row has valid_from and an optional exclusive valid_until. In one scope (for example jurisdiction and key) the ranges are non-empty and do not overlap. Nothing reads the clock. A changed rate is a new release that adds a row; the old release stays staged.

    [origin] is required and checked at staging.

    KeyRule
    kindauthored (written from primary sources). converted and mixed are refused in this release; see “Not in this format release”.
    publisher, licenceRequired. The licence is an SPDX expression of permissive terms only (the list in deny.toml, ADR 0157: MIT, Apache-2.0, BSD, ISC, Zlib, MPL-2.0 and the others there). A OR B needs one allowed term, A AND B all of them; GPL, LGPL and AGPL are refused, as is any unknown term.
    source_document, source_version, verified_on, reviewer, review_statusRequired: the primary document and its version, the date it was read or verified, the reviewer, and pending or reviewed.

    Data from Odoo Enterprise is never admitted. Indonesian packs are authored from primary sources.

    Each cap is a system parameter with a default, a floor and a hard bound; a value outside them is refused naming the key, and zero never means unlimited. The loader receives them through PackLimits::from_params.

    KeyDefaultFloorHard bound
    l10n.pack.max_total_bytes8 MiB1 KiB64 MiB
    l10n.pack.max_file_bytes2 MiB1 KiB16 MiB
    l10n.pack.max_files641512
    l10n.pack.max_rows10000011000000
    l10n.pack.max_fields_per_row641256
    l10n.pack.max_string_bytes40961665536
    l10n.pack.max_ref_edges20000012000000
    l10n.pack.max_parent_depth8132
    l10n.pack.max_code_digits161256
    l10n.pack.max_templates6411024
    l10n.pack.max_dependencies16164

    l10n.pack.max_rows counts the rows of every records, translations and CSV file as they are read (a CSV file is refused as soon as the running count passes the limit) and also the records and translations a child template inherits from its parent: a parent with 1,000 records and 30 children counts 30,000 more. The refusal of an inherited count uses the fixed limit text and names the template in its path (template[<key>].parent). l10n.pack.max_string_bytes bounds every string of a TOML row too (key, template, model, each clear_fields entry, reference and decimal strings), and l10n.pack.max_fields_per_row counts clear_fields entries together with fields.

    Staging the same release with the same digest again changes nothing (StageOutcome::Unchanged). The same release id with other content is refused. A new release of the same pack needs a greater pack_version, a release date that is not earlier, and the releases are kept, never replaced.

    These parts of ADR 0047 D1 and D7 are follow-up tasks of the pack-format work. A pack that uses them is refused by name, never partly accepted: converted and mixed origins with their NOTICE rule and notice files, the checks of supports contract versions, required capabilities and manifest countries, and the dated lookup by date (it belongs to the rule-binding task).