54 lines
1.4 KiB
Markdown
54 lines
1.4 KiB
Markdown
|
|
# Multilingual Support
|
|||
|
|
|
|||
|
|
**Currently viewing: English (EN)**
|
|||
|
|
|
|||
|
|
This page demonstrates FolderWeb's built-in language support. Use the language switcher in the header to toggle between **EN** and **NO** - the page content will change to match your selected language.
|
|||
|
|
|
|||
|
|
## How It Works
|
|||
|
|
|
|||
|
|
Creating multilingual content is straightforward:
|
|||
|
|
|
|||
|
|
1. **Add language codes to filenames** – Create `index.en.md` and `index.no.md`
|
|||
|
|
2. **Language switcher appears automatically** – When multiple versions exist
|
|||
|
|
3. **URLs get language prefixes** – Non-default languages use `/en/page/`, `/no/page/`, etc.
|
|||
|
|
4. **Share metadata** – One `metadata.ini` file per directory works for all languages
|
|||
|
|
|
|||
|
|
## File Structure Example
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
/content/about/
|
|||
|
|
├── index.en.md # English version
|
|||
|
|
├── index.no.md # Norwegian version
|
|||
|
|
└── metadata.ini # Shared metadata
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Configuration
|
|||
|
|
|
|||
|
|
Enable languages in `/app/default/config.ini`:
|
|||
|
|
|
|||
|
|
```ini
|
|||
|
|
[languages]
|
|||
|
|
default = "en"
|
|||
|
|
available = "en,no"
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Translation Strings
|
|||
|
|
|
|||
|
|
UI text comes from language files in `/app/default/languages/`:
|
|||
|
|
|
|||
|
|
```ini
|
|||
|
|
; en.ini
|
|||
|
|
home = "Home"
|
|||
|
|
read_more = "Read more"
|
|||
|
|
|
|||
|
|
; no.ini
|
|||
|
|
home = "Hjem"
|
|||
|
|
read_more = "Les mer"
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Translation strings are optional—templates fall back to sensible defaults if missing.
|
|||
|
|
|
|||
|
|
## Try It
|
|||
|
|
|
|||
|
|
Use the language switcher in the header to toggle between English and Norwegian versions of this page. The content stays the same, just translated.
|