Repository navigation
This version adds localization (i18n). One entry holds the text of each
language of a multilingual website, and the editor shows one language at a
time. Editors and agents can find what still needs a translation.
Added
- Localized fields. A site declares its
locales,defaultLocaleand
fallback, with the names of Astro'si18n. A field withlocalized: true
stores a value for each locale in the same entry, and rich text has one file
for each locale, such asbody.de.mdoc.requiredapplies to the default
locale, and a missing translation never stops Save or Publish (ADR 42). localize(site, name, data, locale)in@micacms/astrogives an entry
or a singleton in one locale. A missing value falls back tofallback, then
to the default locale.localized: { fallback: false }keeps it empty.- The locale in a page's URL. A
urlcan name{locale}, such as
/{locale}/news/{id}, withprefixDefaultLocaleas in Astro. The preview,
"Open on website" and the URL under the ID field show the page of the form's
language, and the live preview's page changes the form's language. A
localizedid()must be unique in each locale:mica checkand Publish
report a duplicate (ADR 43). - A language switcher in the header of a form, with the number of missing
translations of each language. A button beside each localized field shows
its other languages, can use one of them, and marks a missing translation. - Find missing translations. The list of a collection shows the missing
translations of each entry, and a filter shows the entries that miss one
language. The Overview lists them for each language. The MCP tool
list_entriesgivesmissingTranslationsand takesmissing, and
mica checklists them as information. localesOf(site, name, data)in@micacms/astrogives the locales that
an entry has its own text in, forgetStaticPaths, lists, the sitemap and
hreflang(ADR 44).- Links in rich text can get the address in the page's locale, with the
linkoption ofrenderRichText.
Changed
- The header of a form is tidier: the status is below the title, and the
entry's folder is below the form. - A model with locales needs this version of Mica. Upgrade
@micacms/editor
and the image together with@micacms/astro. A site without locales writes
the same.mica/schema.jsonas before.