-
Notifications
You must be signed in to change notification settings - Fork 0
Sites and Languages
Marble supports running multiple sites from one installation. Each site has its own domain, root item, settings item, and default language.
Go to System → Sites in the admin.
| Property | Description |
|---|---|
| Name | Display name |
| Domain | Hostname (e.g. example.com) |
| Root Item | Top-level item of this site's content tree |
| Settings Item | Item returned by Marble::settings() for this site |
| Default Language | Fallback language |
| Default | Used as fallback when no domain matches |
| Active | Disable without deleting |
Marble matches the incoming request hostname to a site's domain. If no match, the default site is used.
$site = Marble::currentSite();Languages are managed under System → Languages. Each has a code (en, de, fr) and a name.
Enable Translatable per blueprint field to store separate values per language. The editor shows a language switcher at the top. Non-translatable fields store a single value.
Controls whether language codes appear in frontend URLs.
uri_locale_prefix = false (default)
All language slugs are served directly, without any prefix. /about-us and /ueber-uns both work and resolve to the same item in their respective languages. Marble detects the language from the slug.
/about-us → item in English
/ueber-uns → same item in German
uri_locale_prefix = true
Every URL is prefixed with the language code. All languages, including the primary, get a prefix.
/en/about-us → item in English
/de/ueber-uns → same item in German
When a field has no translation for the current language (empty or not yet translated), Marble automatically falls back to the primary language value. This means your site will always show content — even if only partially translated — rather than empty fields.
The slug field is never subject to fallback: each language uses its own slug to determine which language to render.
Marble::setLocale('de');
Marble::setLanguageById(2);
Marble::currentLanguageId();
Marble::primaryLanguageId();{{ $item->value('title') }} {{-- Current language --}}
{{ $item->value('title', 'de') }} {{-- German --}}
{{ $item->value('title', 2) }} {{-- Language ID 2 --}}{{ Marble::url($item) }} {{-- Current language --}}
{{ Marble::url($item, 'de') }} {{-- German URL --}}In the item editor sidebar, use Copy Language to copy all field values from one language to another. Useful when starting a translation.