Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 5 Nov 2026. What's built · Install 0.3.0
jadpo
ReferenceText formats

LanguageValues and typesStandard typesText formats

LocalisedText

On this page

The same text in several languages: {"en-GB": "Rye loaf", "fr-FR": "Pain de seigle"}.

Use it for content people translate, such as product names. text.pick gets the entry for a locale. For your app's own wording, use its translations instead.

Shape

A map from Locale to Text.

Example

example
type NotATranslation = Failure {    kind: FailureKind.invalid_value    message: "That isn't a translated name."}var example: LocalisedText = attempt json.read(    "{\"en-GB\":\"Rye loaf\",\"fr-FR\":\"Pain de seigle\"}",    as: LocalisedText) {    invalid: NotATranslation}assert example == example

Good to know

  • It arrives as JSON, from a request or from json.read, since code can't write out a map with entries.
  • == tells you whether two are the same. < and list.sort_by don't take it.

In JSON

An object of its entries, each key written as its text, in a request, a response or json.write:

json
{"en-GB":"Leek soup","fr-FR":"Soupe aux poireaux"}{"en-US":"Leek potage"}{"de-DE":"Lauchsuppe"}

Details

Text form, storage, how it is shown, and operations

LocalisedText is in the group Text formats, and has been in Jadpo since 0.1.0.

Text form

It has no single text form, so text.from and text.parse don't take it.

How it is stored

It is stored in one column named for the field, of type jsonb. {"de-DE":"Lauchsuppe"} is stored as '{"de-DE":"Lauchsuppe"}'::jsonb.

How it is shown to people

text.format(value, locale:) shows it to people in their locale.

With locale: Locale.en_gb:

Value Shown
{"en-GB":"Leek soup","fr-FR":"Soupe aux poireaux"} Leek soup
{"en-US":"Leek potage"} Leek potage
{"de-DE":"Lauchsuppe"} Lauchsuppe
{} ""

Operations

  • text.pick(value: LocalisedText, locale: Locale) -> Text: The text in value for locale: its entry, else the entry of its language (the locale CLDR's likely subtags give for the language first), else the application's default locale's, else the first.

It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.

Markdown for agents: /docs/types/type-localised-text.md.Built from Jadpo main at aee2e8f.