Translations (i18n)
Fullfinity supports multi-language translations using an approach where the English source text serves as the translation key.
Overview
Section titled “Overview”- Backend-driven: All translations are managed on the backend and served to the frontend
- English-text-as-key format: Translation files use
{"English Text": "Translated Text"}format - AI-powered: Translations are generated using OpenAI or Anthropic APIs
- Per-module: Each module has its own
i18n/folder with translation files
Translation File Format
Section titled “Translation File Format”Translation files are stored in each module’s i18n/ directory:
modules/crm/├── models/├── views/└── i18n/ ├── es-419.json # Spanish (Latin America) ├── fr.json # French └── de.json # GermanEach file uses English text as the key:
{ "Customer": "Cliente", "Expected Revenue": "Ingresos esperados", "Mark as Won": "Marcar como ganado", "Leads in this stage are considered won": "Los leads en esta etapa se consideran ganados"}Translation CLI
Section titled “Translation CLI”The fullfinity-translate CLI extracts translatable strings and generates translations.
Basic Usage
Section titled “Basic Usage”# Extract strings from a module (shows counts)./fullfinity-translate -c config.yaml --extract fullfinity/modules/crm
# Translate a single module to Latin American Spanish./fullfinity-translate -c config.yaml fullfinity/modules/crm es-419
# Translate all modules to multiple languages./fullfinity-translate -c config.yaml fullfinity/modules es-419,fr,de
# Translate to all supported languages./fullfinity-translate -c config.yaml --all fullfinity/modules/invoicing
# List supported languages./fullfinity-translate --list-languagesFrontend strings
Section titled “Frontend strings”The web client’s own strings ship with the core module (modules/core/i18n/<lang>.json),
because all translations are served from the backend. They are translated automatically
whenever core is within the path you pass, e.g.:
./fullfinity-translate -c config.yaml fullfinity/modules de # all modules + frontend./fullfinity-translate -c config.yaml fullfinity/modules/core de # core + frontendLoading into the database
Section titled “Loading into the database”Generated i18n/*.json files are not read at runtime — they’re loaded into the
Translation table. After generating, reload them:
- UI: Languages → pick the language → Generate translations (generates + loads in one step), or Reload translations to just load existing files.
- These map to
Language.action_generate_translations/action_load_translations. Loading only happens for installed modules.
Supported Languages
Section titled “Supported Languages”Fullfinity ships these interface languages. Each has a Language record on every database (switched off until someone enables it) and a generated catalog:
| Code | Language |
|---|---|
| en | English (US) — the source language; no catalog |
| en-GB | English (UK) |
| ar | Arabic |
| de | German |
| fr | French (France) |
| fr-CA | French (Canada) |
| pt-PT | Portuguese (Portugal) |
| pt-BR | Portuguese (Brazil) |
| es-419 | Spanish (Latin America) |
en-AU, en-CA, en-IE, en-IN, en-NZ and en-SG are shipped too. They use the
en-GB wording exactly and differ only in the date and number formats on their Language
record, so their catalogs are copies of en-GB’s, written by the CLI after every
generation (or on their own with --mirror-aliases <path>) — never translated separately.
--all generates exactly this list, and --list-languages prints it. A catalog is loaded
by exact code match when its Language is enabled, so a catalog for a code with no Language
record is never read. You can still create a language of your own on the Languages screen
and generate its translations there.
Checking that everything is actually translated
Section titled “Checking that everything is actually translated”A string only reaches a user in their language if three things hold, and each fails silently and independently:
- it is wrapped —
t()in code,T()in a module-scope table, or a display key in YAML; - it is extracted into
i18n/<lang>.json; - the value is looked up where it renders.
All three failures look identical on screen — English text — so finding them by reading the app means opening every page in a real language. Two things replace that.
Catalog completeness (checked when you release)
Section titled “Catalog completeness (checked when you release)”Every catalog that exists must contain every string the extractor can see:
./fullfinity-server -c config.yaml check --only i18n-catalogsIt lists the exact shortfall per catalog, so a partial AI run, an expired key, or a merge that added copy without regenerating is caught with the missing strings named.
tests/ is not extracted. Its literals are fixture data — "Clone Scope Line A", a font
stack, a Q(...) expression — and every one that reached a catalogue was a string somebody
was then asked to translate, which is how this gate came to demand Arabic for a Q-expression.
Nothing a test file says is ever read by a user.
This gate is release-time, not commit-time — like check --only version-bump, it is not
part of a bare check. The only way to satisfy it is to run the translator, which is an LLM
call per language; blocking every commit that adds a line of copy on that just teaches people
to ignore a permanently red build. Regenerate, then check:
./fullfinity-translate -c config.yaml fullfinity/modules/<module> es-419,fr,deAdding a language stays opt-in per module: a module with no de.json is never asked for
German. But once the file is there, it has to be complete.
What is still only caught by looking
Section titled “What is still only caught by looking”Extraction is checked by the release gate above; wrapping is checked on every commit by
./fullfinity-server check --only i18n.
The third link — a value that IS translated but is served past its lookup — is checked per
endpoint (TestViewEndpointsTranslate), because that is where it has actually gone wrong: the
wizard endpoint composed its arch and returned it without translating, so every wizard in the
product rendered English regardless of language while the catalog beside it was complete.
If you add a new endpoint that serves view text or field labels, translate it there and add it to that test. Nothing else will notice.
Configuration
Section titled “Configuration”Add an AI API key to your config.yaml:
# Use either OpenAI or AnthropicOPENAI_API_KEY: "sk-proj-..."# orANTHROPIC_API_KEY: "sk-ant-..."With both keys configured, name the one that pays for translation — otherwise the Anthropic key is used:
TRANSLATION_PROVIDER: openai # or: anthropicThe command line can override it for one run with --provider openai|anthropic. A provider
that refuses a request because the account is out of credit, or rejects the key, stops the
run straight away instead of failing every remaining batch; strings already translated are
kept, and the next run picks up only what is missing.
What Gets Translated
Section titled “What Gets Translated”From Python Models
Section titled “From Python Models”The CLI extracts:
- Field descriptions:
description="Customer Name" - Field hints:
hint="Enter the customer's full name" - Error messages:
raise ValidationError("Invalid email format")— including a fallback inside the raise, e.g.raise UserError(remote_error or "Refund failed.") t("...")message templates (the first argument literal — see Dynamic messages below)
class Contact(Model): name = Char( description="Contact Name", # Extracted hint="Full name of the contact", # Extracted max_length=255 )A field label must be a literal the extractor can read
Section titled “A field label must be a literal the extractor can read”Extraction parses your source, so the label has to be in the source. A long hint split across lines is fine — Python joins the fragments into one string and the extractor reads that same joined string, so the key matches what renders:
hint="Extra days added to the promised delivery date, on top of " "each product's own customer lead time." # ✅ one key, the full sentenceSharing a hint between fields via a module-level constant is fine too — the extractor resolves it:
_BLANK_HINT = "Leave blank to use the mapped account."
expense_account = ManyToOne("Account", description="Expense Account", hint=_BLANK_HINT) # ✅What does not work is a label assembled at runtime, because there is no literal to collect — no key reaches the catalogue and the label stays English in every language:
weight = Float(description=f"Weight ({unit})") # ❌ f-stringstate = Char(description="Status: " + suffix) # ❌ concatenationnote = Char(description=labels["note"]) # ❌ lookup./fullfinity-server check --only i18n fails on these (CI and pre-commit), naming the
file and line. If a label genuinely has to vary, keep the field’s description static
and put the dynamic part in the value or a calculated field instead.
Error messages: static needs nothing, dynamic needs t()
Section titled “Error messages: static needs nothing, dynamic needs t()”A static error message needs no ceremony at all. Write it plainly and it is
extracted by its English text and translated for you — the framework translates the
message where it builds the error response, so every raise below ships in every
language you generate:
raise UserError("Only documents in draft stage can be posted.") # ✅ translated for youraise MissingError("The record has been deleted.") # ✅raise UserError(result.get("error") or "Refund failed.") # ✅ the fallback ships tooThe same applies to a message a helper returns — but there the literal has to be
wrapped, because a return is not a raise and nothing marks it as user-facing:
async def is_valid(self): if self.state == "Expired": return False, t("This coupon has expired.") # ✅ wrapped at the source ...
is_valid, reason = await coupon.is_valid()if not is_valid: raise UserError(reason) # ✅ already translatedDynamic messages — translate the template, don’t build a string
Section titled “Dynamic messages — translate the template, don’t build a string”A message that contains a runtime value must not be built with an f-string:
# WRONG — not translatable. The extractor can't key an f-string, and at runtime the# concrete string ("...at most 1 of Widget.") never matches a translation key.raise UserError(f"You can return at most {qty} of {name}.")Instead use the backend t() helper. It mirrors the frontend t('...{x}', {x}): the
static template is the translation key, and the dynamic values are interpolated
after the template is translated — so runtime values never have to match a key:
from fullfinity.engine.base import t # also available via `from ...base import *`
raise UserError( t("You can return at most {qty} of {name}.", qty=qty, name=name))- The first argument is a static literal with
{name}placeholders — never an f-string. It’s what gets extracted and translated. t()is synchronous — noawait, so it works in both sync and async code. It resolves the current user’s language and reads the in-process translation cache, then fills in the params. A static message with no placeholders works too (t("Only draft returns can be confirmed.")).- Because translation happens server-side at the call site, it works for anything —
UserError/ValidationErrormessages, email bodies, notifications — not just the web client. - Format specs can’t live in the template (they’d break the translation key). Pre-format
the value and pass the string:
t("At most {qty}…", qty=f"{n:g}").
Text you RETURN in a payload — same rule as a raise
Section titled “Text you RETURN in a payload — same rule as a raise”A method that reports through its return value reaches the same reader as one that
raises: an action result’s toast and wizard header, a summary indicator’s rows. Those live
in a dict rather than in a raise, and they follow exactly the same two rules.
A static literal on a display key is extracted for you — no t() needed:
return {"type": "notify", "color": "green", "message": "All variants are up to date."} # ✅return {"type": "wizard", "model": "TransferValidateWizard", "title": "Mark Transfer Done"} # ✅
# A summary payload's rows too — the client looks each label up as it renders them.record.stock_summary = { "status": "Out of Stock", # ✅ "rows": [{"label": "On hand", "value": 19}], # ✅}A runtime value must go through a t() template, for the same reason it must in a
raise — the finished sentence can never match a catalogue key:
# WRONG — English in every language.return {"type": "notify", "message": f"Posted {n} depreciation(s)."}
# RIGHT — the template is the key, the count fills in after the lookup.return {"type": "notify", "message": t_plural( "Posted {count} depreciation.", "Posted {count} depreciations.", count=n)}./fullfinity-server check --only i18n fails on the f-string form for any dict carrying an
action-result type or a status+rows summary payload. Elsewhere a composed label is
left alone on purpose: a great many are stored data — a journal item’s
f"Payment received - {number}" is written to the database in the source language and read
back as content, not looked up as UI.
Assembling a sentence from clauses? Translate each clause, and keep its punctuation inside the template — a language that terminates a sentence differently needs it there:
parts = []if created: parts.append(t_plural("Created {count} new variant.", "Created {count} new variants.", count=created))if archived: parts.append(t_plural("Archived {count} obsolete variant.", "Archived {count} obsolete variants.", count=archived))return {"type": "notify", "message": " ".join(parts)}Messages collected into a list you return — t() every one, even a static one
Section titled “Messages collected into a list you return — t() every one, even a static one”A validator that reports every problem at once cannot raise on the first, so it collects
them and returns the list for its caller to show — joined into a toast, stored on the record,
listed in a report. That text is neither a raise argument nor a payload value, and unlike
a raise nothing translates it on the way out: the caller receives finished strings. So
each message is translated where it is appended — a static one included:
async def _einvoice_profile_validation(self): errors = await super()._einvoice_profile_validation()
# WRONG — both stay English in every language. errors.append("XRechnung requires a seller email address (BR-DE-4).") errors.append(f"Line '{label}' is missing an HSN/SAC code on its product.")
# RIGHT — the template is the key; the value fills in after the lookup. errors.append(t("XRechnung requires a seller email address (BR-DE-4).")) errors.append(t("Line '{label}' is missing an HSN/SAC code on its product.", label=label)) return errors./fullfinity-server check --only i18n enforces it. Within one function, a list is a
sink when the function returns it (alone or in a returned tuple) or mentions it inside
raise UserError/ValidationError/AccessError/MissingError(…); an append to a sink fails
when it adds an f-string, a %/.format() string or a literal concatenation with words in
it, or a plain literal that reads as a sentence (several words, ending in ., ! or
?). What it leaves alone:
append(t(…))andappend(t_plural(…)), or a variable / call result — composed elsewhere;- a list of values (
methods.append("Bank Account (ACH)")) — a word is data the caller dispatches on, not a message, and translating it would break that comparison; - HTML assembled from tags (
"<p>" + body + "</p>"); - a list that only feeds a
ConfigurationError/InternalError— that is developer output.
Output aimed at whoever authored the module (a view-arch validator, an upgrade check) opts out
with # i18n: diagnostic — on the append, once on the line creating the list
(errors = [] # i18n: diagnostic), or on the def line when the whole function is
developer-facing.
A message that counts things — t_plural, never “(s)”
Section titled “A message that counts things — t_plural, never “(s)””t() stores one string per message, so a sentence whose wording changes with a count has
nowhere to put the second form. English papers over it with a hedge — “Queued {count}
invitation email(s).” — which reads badly here and cannot be written correctly at all in
a language with more than two forms. Arabic distinguishes six (zero/one/two/few/many/other),
Russian and Polish four; whichever single form the catalogue stored is wrong for most counts,
and it renders without complaint.
# WRONG — one stored string cannot serve every count.t("Queued {count} invitation email(s).", count=sent)
# RIGHT — both English forms in the source; the reader's language picks its own.t_plural("Queued {count} invitation email.", "Queued {count} invitation emails.", count=sent)- The plural is the catalogue key (English’s general form). The singular ships beside it in the source as the untranslated fallback and needs no key of its own.
countdrives the selection and is also available as{count}. It does not have to appear in the template — pass a pre-formatted value under another placeholder when the number is displayed differently:t_plural("… {reserved} unit is …", "… {reserved} units are …", count=reserved, reserved=f"{reserved:g}").- One count per message. A sentence carrying two independent counts cannot be right for
both, whichever form is chosen — split it into clauses and pluralise each:
" ".join([t_plural("Moved {count} workspace.", "Moved {count} workspaces.", count=moved), …]).
The catalogue stores a plural as an object of forms, filled in per language by the translator:
{ "Queued {count} invitation emails.": { "zero": "…", "one": "…", "two": "…", "few": "…", "many": "…", "other": "…" }}check --only i18n fails on the two shapes that are unambiguous — an (s) hedge, and a
count placeholder followed by a plural noun ("{count} records selected", which simply reads
wrong at one). A message that merely CARRIES a count without a word that inflects with it is
left alone. check --only i18n-catalogs fails on a plural key stored as a flat string, or
missing one of the language’s categories. A developer diagnostic opts out of the first with
# i18n: diagnostic.
The same rule retires the hand-rolled English plural — n === 1 ? t('1 day') : t('{count} days', {count: n}). It is correct in English and wrong everywhere with more than two forms,
and it was written in several places precisely because the framework offered nothing better.
Avatar letters — initials_of
Section titled “Avatar letters — initials_of”When a person or company has no picture, every surface shows the same letters for them:
the first letter of the first and last word, ignoring anything that is not a letter or a
number (brackets, hyphens, quotes, emoji), upper-cased where the script has case. A single
word gives its first letter. “Amir (Acme Tools)” is AT, “Émile” is É, “王小明” is 王.
from fullfinity.engine.base import initials_of # also via `from ...base import *`
initials_of("Amir (Acme Tools)") # -> "AT"initials_of("---", "?") # -> "?" (the fallback, when nothing is left)In a template, {{ name|initials }} applies the same rule. The back office’s avatars use
it too, so never derive initials yourself for a page, a kiosk or a widget — a hand-written
name[0] disagrees with every other screen the moment a name starts with a bracket.
Naming records in a message — summarize_list
Section titled “Naming records in a message — summarize_list”A message that names the rows something went wrong on must not grow with how many rows there are. Joining the whole list reads fine while you’re testing with three lines and is unreadable at thirty — and the list or form behind the toast is already showing that same per-record detail, where the user can scroll, sort and filter it:
# WRONG — the toast is as long as the document.raise UserError(t("Still short: {items}.", items=", ".join(names)))summarize_list names a few and counts the rest, so the message has a fixed ceiling
whatever the data does:
from fullfinity.engine.base import summarize_list # also via `from ...base import *`
raise UserError( t("Still short: {items}. Reserve the missing stock.", items=summarize_list(names)))# -> "Still short: Widget, Gadget, Bolt and 27 more. Reserve the missing stock."- The total survives the cap — the overflow count is what the user needs; the identities of rows 4..30 belong on the rows.
limitis how many are named before overflow: the default3suits an inline list in a toast,5or so suits a bulletedseparator="\n"list, which has more room. A list exactly one item over the limit is shown in full, since naming the last item beats “and 1 more”.separatorjoins the shown items. The overflow phrase goes on its own line for line-based separators and after a space otherwise.- Returns
""for an empty list, sosummarize_list(x) or t("…")works as a fallback. - If a full list genuinely has to be preserved, put it on the record — a field, a log line, a chatter note — and let the message point at it. Only the transient message is capped.
A list that’s bounded by code rather than data — the valid choices for a Selection, a fixed set of column names — needs none of this; naming all of them is the useful answer.
./fullfinity-server check --only i18n (CI and pre-commit) fails on a user-facing
exception — UserError, ValidationError, AccessError, MissingError — whose message
is assembled with an f-string, %, .format() or concatenation, naming the file and
line. The other exception types render a developer modal with a traceback, so they are
not checked.
If a message really is output for whoever wrote the module rather than for an end user — a bad view definition, an upgrade punch-list, a CLI hint — mark the raise and it is skipped by both the gate and extraction:
raise UserError(f"UiView {path}: 'confirm' needs a message.") # i18n: diagnosticBuild the message at raise time, not at import time. A module-level constant is
evaluated once, before any request exists, so t() there would freeze whatever language
the worker started in — wrap it in a small function instead:
_CONFLICT = t("Someone else changed this report…") # ❌ resolved once, at importdef _conflict() -> str: return t("Someone else changed this report…") # ✅ resolved per requestFrom View YAML
Section titled “From View YAML”The CLI extracts these keys from view definitions:
title- Section/tab titleslabel- Field labelsdescription- Descriptionsplaceholder- Input placeholdershint- Help textmessage- Messagesname- Only fromUiMenuandWindowAction(display names)
- type: field name: contact properties: label: Customer placeholder: Select a customer hint: The customer for this orderFrom island JavaScript
Section titled “From island JavaScript”An island (see window.fullfinity) translates with window.fullfinity.t, and the extractor
collects t('…') calls from a module’s static/**/*.js. The English text is the key —
pass it as the first argument:
const { t } = window.fullfinity;t("Save Changes") // key + fallback in onet("Added {name} to your cart", { name }) // with interpolation paramsDo not invent a separate identifier key, e.g. t("save_changes", "Save Changes").
The whole pipeline (extraction, i18n/*.json, the Translation.key/source columns,
and the served lookup dict) is keyed by the English source text, so a synthetic key
like "save_changes" is never present at runtime and the string silently falls back to
English. Keying by the English text is also collision-free — the source string is
already unique, whereas a lowercased/underscored identifier can collapse distinct
strings together ("Sign up" and "Sign-up").
From Server-Rendered Templates (Jinja)
Section titled “From Server-Rendered Templates (Jinja)”Portal, website and email templates translate explicitly, through the same English-text-is-the-key rule:
<h1>{{ t('Your Orders') }}</h1><p>{{ t('Dear {name},', name=contact.name) }}</p>Report and email bodies get t() for free — the framework builds those environments.
An email template’s subject translates the same way, written as a Jinja expression in its
data file — subject: "{{ t('Your order {name}', name=name) }}" (the record’s fields are top-level names in the render context) — and the extractor
collects the English inside t() as the key.
A module that builds its own Environment(...) for its page templates must install the
global itself, or every {{ t('…') }} in the templates it renders raises
't' is undefined at render time:
from jinja2 import Environment, FileSystemLoaderfrom fullfinity.engine.jinja_filters import install_translation_global
my_env = install_translation_global( Environment(loader=FileSystemLoader(_template_dir), autoescape=True))autoescape=True is required, and check --only autoescape fails the build without it.
Without escaping, anything a visitor typed (a comment, a review, a forum title) is printed
into every other visitor’s page as live HTML. select_autoescape() with no arguments does
not count: it escapes only .html/.htm/.xml, and module templates are .jinja. Mark
HTML you built on the server on purpose with {{ body | safe }}, and pass data to an island
with {{ props | tojson }}.
Two things to know about it:
- A global, not a context variable. An
{% import %}ed macro never sees the caller’s render context, so a macro that translates its own labels can only read a global. Passingtin the render context alone leaves every macro broken. - A context translator still wins. A page that resolves its own language (from the visitor’s language cookie, or a recipient’s language on an email) puts that translator in the render context, which shadows the global. Installing the global doesn’t override per-visitor language — it’s the floor for renders that never set one.
- It also installs the display filters —
|money,|number,|date,|datetimeand|relative_date— so a module page never has to format an amount or a date by hand.{{ total|money }}takes the symbol side, decimals and grouping characters from thecurrencyin the render context. Anything you bound yourself before calling it is left alone.
./fullfinity-server check --only i18n fails on a module environment with no translator
bound, alongside the unwrapped-string rules.
Dates follow the user’s language
Section titled “Dates follow the user’s language”Month and weekday names in dates render in the viewer’s language — you don’t translate
them by hand (they aren’t t() strings), the formatter does it.
-
Server-rendered templates — the
|dateJinja filter localizes automatically. Pass an explicit pattern ({{ d|date("MMMM D, YYYY") }}) and the word tokens still localize. Without one, what it writes depends on the surface — see Public pages below for website and portal pages; elsewhere it uses the language’sdate_format. -
A date inside a message (an error, a toast, a chatter note, an email, a
t()placeholder) —readable_date(d),readable_datetime(moment)orreadable_date_range(start, end), all infullfinity.engine.base. They write the reader’s own regional form in their language and time zone, so the same message reads10 Nov 2026to one user andNov 10, 2026to another, and a range readsJan 1 – Mar 31, 2026or1. Jan. – 31. März 2026:raise UserError(t("The period is locked through {date}.", date=readable_date(lock_date)))Never pass the date itself (
date=lock_dateprints2026-11-10),str()/.isoformat()it, or.strftime()it —check --only i18nfails on all of these in at()placeholder, a user-facing error, or a message body. A placeholder named like a date that holds something else is marked# i18n: not-a-dateon that line.readable_datetime(..., tz=zone, with_zone=True)shows a time in a zone of its own (an appointment at its location) and labels it. -
A label with a deliberate shape (a
Nov 2026period, aMon 10column header) —format_localized(value, fmt)(fromfullfinity.engine.jinja_filters):fmtis an ordinarystrftimepattern whose month/weekday names localize to the current render’s language, then the logged-in user’s, else English. It never raises (any failure falls back to Englishstrftime). Keep barestrftimeonly for machine formats that must stay fixed (RSS/RFC-822 dates, filenames, ISO keys). -
The web client — dates in views and widgets follow the user’s language, including the first day of the week. No per-call work.
Outside public pages, the language carries only the names; numeric layout/order
(DD/MM vs MM/DD) comes from the language’s date_format.
Public pages: the reader’s locale and time zone
Section titled “Public pages: the reader’s locale and time zone”On a website or portal page, which translation is read and how a date or number is written are two separate answers:
- Page language — the visitor’s
?lang=link, else a signed-in person’s account language, else the language switcher’s cookie, else their browser’sAccept-Language, else the site’s default. Always a language the site offers. - Formatting locale — the reader’s own regional form of that language, from their account
language and then their browser’s
Accept-Language(en-AU,en-IN,de-CH,fr-CA, …), with formats taken from CLDR. It covers every region, whether or not aLanguagerecord exists for it. An Australian on the English site reads10 Nov 2026, an AmericanNov 10, 2026; an Indian reads1,23,45,678, a Swiss reader1’234’567. - Time zone — for a signed-in person, their account time zone; for an anonymous
visitor, the browser’s own, which the islands framework stores in the
ff_tzcookie on every public page. Otherwise UTC.
The filters, on those pages:
| Filter | Writes |
|---|---|
{{ d|date }} | the locale’s medium date, in the reader’s time zone — 10 Nov 2026 |
{{ d|datetime }} | date and time of day — 10 Nov 2026 7:30 am |
{{ d|relative_date }} | 3 hours ago within a week, the date after that, as a <time> element with the exact moment in datetime and title |
A Date field (no time of day) is never shifted between time zones; a Datetime is. A
module page built with install_translation_global gets all three, reading the render
context the website builds — nothing to wire.
Never .strftime( in a template. It prints the US order, English month names and UTC for
every reader, and nothing raises. check --only i18n fails on it in any module template; use
the filters above. A machine format (an RSS date, a sitemap lastmod, a file name) belongs in
Python, where it stays fixed on purpose.
Formatting in Python during a page request — a route building a label, a model building
a slot list for an island — uses the same reader, from fullfinity.engine.locale_format:
from fullfinity.engine.locale_format import ( format_date, format_datetime, format_day, format_time, reader_locale_tag, reader_timezone,)
label = format_date(post.published_date, reader_locale_tag(), reader_timezone())reader_locale_tag() is the reader’s formatting locale when a public page is being rendered,
else the render’s language (a customer PDF sets the customer’s), else the signed-in user’s;
ambient_number_locale() (from fullfinity.engine.jinja_filters) follows the same reader for numbers. An API call made by a page’s
own island has no page render behind it: pass the page’s locale in the island’s props and
send it back (normalize_locale(tag) validates it).
Times that belong to a place are shown in that place’s zone, labelled, not converted: an
in-person event starting at 9:00 in Sydney reads “9:00 AEDT” to everyone
(format_datetime(value, locale, zone, with_zone=True)). Convert into the reader’s zone only
when there is no place — an online event, a booking slot, a post’s publication time.
Signed-in customers choose their account language on My Account in the portal, and the site’s language switcher saves to the account too, so the choice follows them to other devices and to the emails they receive.
The account time zone is always stored
Section titled “The account time zone is always stored”A user’s time zone (User.timezone) always holds a real zone, never “blank = ask the browser”:
an email, a PDF or a scheduled job writes times with no browser to ask. What changes is who
keeps it current, decided by Set Time Zone Automatically (User.timezone_auto):
- On (the default for a new user given no zone) — the zone a signed-in browser reports in
ff_tzis adopted intoUser.timezone, by the backend app when it loads and by every public page. A laptop that travels takes the account with it, so the page, the app and the emails agree. - Off — the person (or an administrator) chose a zone. Choosing one switches automatic off, and from then on no device overrides it.
Users choose on Preferences in the app or My Account in the portal (where “Automatic”
names the zone it currently resolves to). Code acting for a user reads User.timezone, never
the cookie: the stored zone is the one answer for every surface, including those with no
request at all.
An employee’s own time zone, which drives their work schedule and attendance, follows their user’s only when the user chooses a zone — not when a device reports one, since a business trip must not move their working hours.
Numbers follow the user’s language
Section titled “Numbers follow the user’s language”A language also carries how a figure is punctuated: decimal_separator,
thousands_separator, and grouping — the group sizes, counted from the right, with the
last size repeating. "3" is the Western 12,345,678; "3;2" is the South Asian
lakh/crore 1,23,45,678. Amounts, floats and integers rendered by the framework’s widgets
already use these, so a Monetary or Number field needs no per-field work.
Money: the reader punctuates, the currency names
Section titled “Money: the reader punctuates, the currency names”A monetary amount has two owners, one property each:
| Property | Owner |
|---|---|
Symbol (€, $, CA$) | the Currency |
Which side the symbol sits on (position: Before / After) | the Currency |
Decimal places (from rounding: 0.01 → 2, 1 → 0) | the Currency |
| Decimal mark, thousands separator, digit grouping | the reader’s Language |
So the same euro amount reads €1,234.56 to an English reader and €1.234,56 to a German
one, and an en-IN user reads a USD total as $1,23,45,678.00. A Currency has no separators
of its own: they are how a person writes a number, and a figure punctuated any other way
reads wrong to them (an English-language Irish invoice is €18.40, never €18,40).
The symbol’s side stays the currency’s position — it is configured once per currency and
applies to every reader. A leading symbol sits tight against the figure (€18.40), a
trailing one after a space (18.40 €), and a negative amount leads with its sign
(-€18.40).
In server-rendered templates — reports, portal pages, website pages, emails — both filters resolve the reader for you from the render language:
{{ qty | number }}takes all three properties from the page language, so a German render prints1.234,56and an Indian one1,23,456.{{ total | money(currency) }}takes the same three from the page language, and the symbol, its side and the decimals from the currency.
In Python outside a template, format_monetary(value, currency, locale=…) (from
fullfinity.engine.template_compiler) is the same formatter, and locale is a required
keyword — leaving it out raises rather than silently printing US punctuation for everyone.
Answer it with the reader you are writing for:
from fullfinity.engine.jinja_filters import ambient_number_locale, get_number_localefrom fullfinity.engine.template_compiler import format_monetary
# A message the current user (or the page's visitor) reads:raise UserError(t("Payment amount cannot exceed {amount}.", amount=format_monetary(ceiling, invoice.currency, locale=await ambient_number_locale())))
# A document for a named recipient: their languagenumber_format = await get_number_locale(env, language_id=customer_language_id)label = format_monetary(total, order.currency, locale=number_format)Pass locale=None only for text with no reader of its own (a value stored once in the source
language, a log line) — it means US English punctuation.
In an island on a public page, window.fullfinity.formatMoney(amount, currency) reads the
page’s own number punctuation (the same the server’s |money used for that page), so a
figure the customer edits in place reads exactly like the one the server drew. Hand it the
currency’s display fields — symbol, position, rounding.
The render language is the reader’s: a customer-facing document resolves it from the
recipient’s contact, falling back to the sending user’s. Nothing per-template is needed — a
body that prints {{ line.quantity | number(rounding=line.uom.rounding) }} already follows
whichever language the document is being rendered in.
How Translation Works at Runtime
Section titled “How Translation Works at Runtime”Backend
Section titled “Backend”Views, menus and field labels are translated as the request is served. Error messages
are translated where the error response is built, so a static message is looked up by
its English text with nothing needed at the raise; a message that carries a runtime
value is already translated by the time it is raised, because t() did it. The framework’s
own messages (a duplicate-key or required-field error, a permission refusal) go through
the same lookup — they live in the core catalog, which every database has.
Outside a request — a scheduled job, a CLI install — there is no user and therefore no
language, so t() returns the English template rather than failing.
The translate_arch() function translates view architectures based on user language:
from fullfinity.engine.translation import translate_arch, get_translations_dict
# Get translations for Germantranslations = await get_translations_dict(env, "de")
# Translate a viewtranslated_arch = translate_arch(view.arch, translations)Adding New Translatable Strings
Section titled “Adding New Translatable Strings”- In Python models, use
description=andhint=:
name = Char(description="Product Name", hint="Enter product name")- In view YAML, the
title,label,placeholderandhintproperties are extracted:
- type: column anchor: customer_info properties: title: Customer Information content: [...]- In templates and island JavaScript, wrap with
t():
<button>{{ t('Submit Order') }}</button>- Run the translation CLI to generate translations:
./fullfinity-translate -c config.yaml fullfinity/modules/mymodule es-419Shipped vocabulary in RECORDS — translate=True
Section titled “Shipped vocabulary in RECORDS — translate=True”A stage called “Qualified”, a unit called “Dozen”, a journal called “Bank” — the product ships those as records, and their names are words we translate, not a customer’s data. A record’s translation is stored per record (not resolved through the shared catalogue at read time, which is keyed by English TEXT and could not tell a caption from a value — that is how a user named “Admin” once came back as the Arabic word for “Administration”). So the field has to opt in:
class CrmStage(Model): name = Char(max_length=255, index=True, description="Stage Name", translate=True)That single flag is the whole opt-in. Enabling a language then copies the shipped
translation into the row — only into rows a data file authored (an identifier somebody
wrote, not the ORM’s auto <Model>_<uuid> shape), and only where the entry is absent, so
a name the customer typed is never touched and a translation they edited survives every
upgrade.
What earns it: workflow vocabulary the product defines and the user only reads — stages, reasons, activity/ticket/leave types, incoterms, payment terms, routes, report and template names, the default teams, seeded stock locations and journals.
What does not: the customer’s own data, and anything whose name is legally meaningful.
The chart of accounts, taxes, tax-report boxes and salary components are shipped by
l10n_* packs per country and stay exactly as that country’s rules name them. Nor do ISO
tokens (PaperFormat “A4”), currency codes, or language names (shown as endonyms).
Website content: contributing your records to the translator
Section titled “Website content: contributing your records to the translator”The strings above are yours as a developer — field labels, view titles, messages you wrote. A website also displays records the user created: pages, menu labels, and whatever your own module puts on the site. Those are translated by the same source-keyed mechanism, but they have to be collected first, because nothing can scan a database for “text a visitor will read”.
Two halves, and they must agree:
-
Render the value through
t()in your template, exactly as you would a literal. The English text is the key, so{{ t(product.name) }}looks up the product’s own name and falls back to it when no translation exists. -
Contribute it to the harvest by extending
Website._collect_translatable_strings(). Callsuper(), add your own, return the dict. The website module never has to know your model exists — the same shape ascollect_content_sitemap_urlsfor the sitemap.
class WebsiteBlog(Model): __inherit__ = "Website"
async def _collect_translatable_strings(self) -> dict: strings = await super()._collect_translatable_strings()
from fullfinity.modules.website.models.website import collect_text_values
Post = get_model("BlogPost") for post in await Post.filter(published=True).all(): collect_text_values(strings, post.title) collect_text_values(strings, post.summary) return stringscollect_text_values(target, value) walks strings, dicts and lists — so a whole settings
blob can be handed over without knowing its shape — and skips anything that is plainly not
prose (URLs, colours, CSS values, text with no letters in it). Use it rather than writing
into the dict yourself: a translator handed #f5f5f5 will cheerfully invent something.
Collect only what the site actually publishes. Translating a draft is paying for text nobody will read.
A string rendered through t() but never harvested renders in English forever, silently —
which is the failure this pairing exists to prevent, so add both halves in the same change.
Incremental Translation
Section titled “Incremental Translation”The CLI only translates new strings. Existing translations are preserved:
# First run: translates all 50 strings./fullfinity-translate -c config.yaml fullfinity/modules/crm es-419# Output: Translating 50 new strings...
# Add new fields, run again: only new strings translated./fullfinity-translate -c config.yaml fullfinity/modules/crm es-419# Output: Translating 3 new strings...Best Practices
Section titled “Best Practices”-
Use descriptive English text - The English text becomes the key, so make it clear and unique
-
Never bake a value into a message -
t("Only {n} left.", n=count), neverf"Only {count} left.". The template is the key; a finished sentence with a value in it can never match one -
Avoid programmatic strings - Don’t translate identifiers, field names, or code
-
Review AI translations - AI translations are good but may need manual review for domain-specific terms
-
Translate early and often - Run translations as part of your development workflow
-
Keep translations in version control - The
i18n/*.jsonfiles should be committed