Skip to content
New: Customize your theme with an AI assistant. Read the guide

Multilingual URL Behavior

Techbyte’s multilingual system is easy to misread because there are three different layers involved:

  1. src/config/language.json
  2. settings.multilingual in config.toml
  3. helper logic in src/lib/utils/i18nUtils.ts

Language Definitions

The available languages come from:

[
{
"languageName": "English",
"languageCode": "en",
"contentDir": "english",
"dir": "ltr",
"ogLocale": "en_US",
"dateLocale": "en-US",
"weight": 1
},
{
"languageName": "Français",
"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
}
]

For how right-to-left works, see RTL & Arabic.

Main Multilingual Settings

In src/config/config.toml:

[settings.multilingual]
enable = true
defaultLanguage = "en"
disableLanguages = [""]
showDefaultLangInUrl = false

WhatshowDefaultLangInUrl = falseMeans

This is the setting that confuses most people.

When it is false:

  • English pages use URLs like /about/
  • Other languages use URLs like /fr/about/ and /ar/about/

When it is true:

  • English pages use /en/about/
  • Other languages still use /fr/about/ and /ar/about/

How Static Paths Are Generated

Techbyte uses helper functions like generatePaths() and supportedLanguages from i18nUtils.ts.

Those helpers decide whether the language param becomes:

  • undefined for the default language
  • or an explicit code such as fr

based on showDefaultLangInUrl.

Localized URLs In Components

Links are usually generated with:

getLocaleUrlCTM("/contact/", Astro.currentLocale)

That helper also:

  • keeps external links untouched
  • handles mailto: and tel:
  • strips .md/.mdx endings
  • applies trailing slash behavior

Removing Languages

To remove one language, add its code to disableLanguages in [settings.multilingual], and restart dev. Its files stay in the project.

To keep only your default language:

  • Astro: set enable = false in [settings.multilingual], run npm run dev once, then run npm run remove-multilingual.
  • Tina: set enable = false, then run npm run toml:watch, npm run remove-multilingual, and npm run tina:generate.
  • Sanity: run npm run remove-multilingual. The other languages’ documents stay in your project unless you add -- --delete-online, which deletes them and can’t be undone.

In the Astro and Tina editions, remove-multilingual also removes those languages’ blocks from netlify.toml. In the Sanity edition, delete those blocks yourself if you host on Netlify.

To add a language, see Internationalization. In all three editions, the script adds the new language’s block to netlify.toml.

Practical Editing Advice

If links look wrong after enabling or disabling multilingual mode:

  1. check language.json
  2. check settings.multilingual in config.toml
  3. restart dev so config-derived logic fully refreshes
  4. make sure your content exists in the expected language folders (english/, french/, arabic/). A language with a missing file shows the default language’s text
Type something to search...