Internationalization
Files: src/config/language.json, src/config/config.toml, src/i18n/, src/config/menu.<lang>.json, english/, french/, and arabic/ content folders · Skill level: Beginner to intermediate
In the Tina edition, each language has its own folder or file under each entry at /admin/, including Menus and Interface labels. In the Sanity edition, each language is an entry under Content in the Studio, with its own Menus and Interface labels. language.json stays in the project in every edition.
Taskly ships in English (default, at /), French (at /fr/), and Arabic (at /ar/). Arabic is the right-to-left example: the whole layout, menus, icons, and marquees mirror on /ar/ pages. See RTL & Arabic. The Arabic text is a machine translation, so have a native speaker review it before you publish.
Each language has:
- its own content folder inside every collection:
src/content/<collection>/english/,french/, andarabic/ - its own interface text:
src/i18n/en.json,fr.json, andar.json(buttons, labels, form messages, the footer text, the tagline) - its own menus:
src/config/menu.en.json,menu.fr.json, andmenu.ar.json(breadcrumb labels come from the menu names, so they are translated too)
The language links are in the footer (and at the top of the auth screens).
Settings
[settings.multilingual] enable = true defaultLanguage = "en" disableLanguages = [""] # for example ["fr"] to stop building French showDefaultLangInUrl = false # true puts English at /en/ tooRestart npm run dev after any change here. The languages themselves are listed in src/config/language.json:
[ { "languageName": "En", "languageCode": "en", "contentDir": "english", "dir": "ltr", "ogLocale": "en_US", "dateLocale": "en-US", "weight": 1 }, { "languageName": "Fr", "languageCode": "fr", "contentDir": "french", "dir": "ltr", "ogLocale": "fr_FR", "dateLocale": "fr-FR", "weight": 2 }, { "languageName": "العربية", "languageCode": "ar", "contentDir": "arabic", "dir": "rtl", "ogLocale": "ar_SA", "dateLocale": "ar", "weight": 3 }]dir sets the direction: ltr or rtl.
Remove A Language
One language: add its code to disableLanguages in [settings.multilingual], for example ["ar"]. Its files stay on disk but are not built. This works the same in every edition.
Keep only your default language, Astro and Tina editions: set enable = false under [settings.multilingual], run npm run dev once (so the setting is converted), then:
npm run remove-multilingualIt deletes the other languages’ content folders, menu files, and i18n files, and rewrites language.json. Save a checkpoint first: this can’t be undone without one.
Keep only your default language, Sanity edition: run npm run remove-multilingual. It updates language.json and the seed file. The other languages’ documents stay in your Sanity project unless you add -- --delete-online, which deletes them and cannot be undone.
Add A Language
This is the “Add or remove a language” recipe in SKILLS.md. Example: German, code de, folder german.
-
Run the command for your edition. For a right-to-left language, add
--dir rtl.Astro and Tina editions:
Terminal window npm run generate-multilingual-content -- --lang de --name Deutsch --dir-name german --locale de-DE --og de_DESanity edition (the last flag is different):
Terminal window npm run generate-multilingual-content -- --lang de --name Deutsch --dir-name german --locale de-DE --og-locale de_DE -
Translate. In the Astro and Tina editions, the command copied the default language to the new
german/content folders,src/config/menu.de.json, andsrc/i18n/de.json. It keeps files that already exist unless you add--force. In the Sanity edition, it created a copy of every default-language document in your project, and your other documents are not touched. -
In the Tina edition, run
npm run tina:generateso the editor offers the new language. -
On Netlify, add a
/de/*404 block tonetlify.toml(copy the French one). Restart the dev server.
An AI assistant translates well, one folder at a time.
Replace French With Another Language
To ship another language instead of French, add it (above), check it, then add "fr" to disableLanguages, or delete the french/ folders, menu.fr.json, fr.json, and its entry in language.json.
What To Translate
- Every content file, including
src/content/sections/<language>/andsrc/content/widgets/<language>/(the dashboard sample data, the announcement bar, the cookie banner). src/i18n/<lang>.json, includingsite.tagline, which is added to page titles.src/config/menu.<lang>.json.
Keep the file names the same in every language: the language links open the same URL in the other language.
Things To Know
- Copy every file: a page whose content file is missing in a language folder can break or disappear in that language. Check each page in the new language after copying.
- Translated 404 pages: each language has one at
/<code>/404/.netlify.tomlships blocks for/fr/*and/ar/*, and each new language needs its own. Other hosts show their own 404 or the default one. - Arabic text uses IBM Plex Sans Arabic, which loads only on Arabic pages (
languagesinsrc/config/fonts.json). A new right-to-left language needs a font that covers it. - Generated Open Graph cards skip right-to-left languages, which use the shared
[opengraph] image.
Do It With AI
Follow the "Add or remove a language" skill in SKILLS.md to add Spanish (code "es", folder"spanish"). Run npm run generate-multilingual-content with the flags in README.md, then translateevery file it created in spanish/, src/config/menu.es.json, and src/i18n/es.json. Keep keys, filenames, URLs, icon names, and layout values unchanged. Add the /es/* 404 block to netlify.toml. Doone collection at a time and tell me when each is done.