Appearance
๐ Multilingual Routing โ
WBC-Routes2 makes internationalization painless and elegant by directly supporting multilingual content inside routing definitions.
You can define your route content per language, and WBC will intelligently render the correct one based on your appโs current `i18n.locale or custom logic.
๐ง Why This Matters โ
Multilingual routing helps:
- Provide a better user experience.
- Boost SEO for localized content.
- Maintain clarity between different content versions.
- Avoid duplicated route logic or nested layouts.
๐ Language-Aware Markdown Routing โ
WBC lets you associate a route path with multiple content sources (e.g., markdown files or components) for different languages.
Example: Route Based on Current Language โ
js
{
path: "/docs/start",
name: "LocalizedStartDocs",
component: WBC,
props: {
item: {
en: "./docs/start-en.md",
fr: "./docs/start-fr.md",
ar: "./docs/start-ar.md",
de: "./docs/start-de.md"
}
}
}If the current language is fr, then the file start-fr.md` is rendered.
๐ฌ Language-Specific Markdown Strings โ
You can also use inline markdown blocks mapped to languages.
js
{
path: "/hello-world",
name: "HelloWorldMultilang",
component: WBC,
props: {
item: {
en: "MD__## Hello World ๐",
fr: "MD__## Bonjour le monde ๐",
ar: "MD__## ู
ุฑุญุจูุง ุจุงูุนุงูู
๐"
}
}
}๐งฉ Multilingual Components and Props โ
WBC supports deep multilingual objects โ you can assign different values for each language inside component props.
Example: VCard with localized content โ
js
{
path: "/intro/card",
name: "LocalizedCard",
component: WBC,
props: {
item: {
comp: "VCard",
options: {
class: "ma-5 pa-5",
html: {
en: "Welcome to the English version.",
fr: "Bienvenue ร la version franรงaise.",
ar: "ู
ุฑุญุจูุง ุจู ูู ุงููุณุฎุฉ ุงูุนุฑุจูุฉ."
}
}
}
}
}๐ Nested Multilingual Arrays โ
WBC-Routes2 also supports arrays where each element can be multilingual.
js
{
path: "/intro/mixed",
name: "MixedLocalizedRoute",
component: WBC,
props: {
item: [
{
en: "MD__## Hello!",
fr: "MD__## Salut !",
ar: "MD__## ุฃููุงู!"
},
{
en: "./files/intro-en.md",
fr: "./files/intro-fr.md"
},
{
comp: "VAlert",
options: {
type: "info",
html: {
en: "This alert is localized.",
fr: "Cette alerte est localisรฉe.",
ar: "ูุฐุง ุงูุชูุจูู ู
ุชุฑุฌู
."
}
}
}
]
}
}๐ Runtime Language Switching โ
If you integrate vue-i18n, WBC-Routes2 will automatically react to `i18n.locale changes.
js
// Switch language dynamically
this.`i18n.locale = 'fr'The displayed route content updates immediately.
๐ฅ External JSON or JS Language Mapping โ
You can also load multilingual route content from JSON files:
File: ./routes/langContent.js
js
export default {
en: [
"MD__## Welcome EN",
"./files/doc-en.md"
],
fr: [
"MD__## Bienvenue FR",
"./files/doc-fr.md"
]
};Route Config:
js
{
path: "/localized/content",
name: "ExternalLangRoute",
component: WBC,
props: {
item: () => import("./routes/langContent.js").then(mod => mod.default)
}
}โ๏ธ Example with Markdown + Meta + Vue โ
js
{
path: "/intro/mixed-meta",
name: "LocalizedWithMeta",
component: WBC,
props: {
item: [
{
en: "./docs/intro-en.md",
fr: "./docs/intro-fr.md"
},
{
comp: "meta",
title: {
en: "WBC in English",
fr: "WBC en Franรงais"
},
description: {
en: "Explore WBC-Routes2 with localized documentation",
fr: "Explorez WBC-Routes2 avec une documentation localisรฉe"
},
keywords: ["vue", "wbc", "routes", "i18n", "multilang"]
}
]
}
}This example renders a localized markdown document and injects localized metadata for SEO and sharing.
๐ Summary โ
WBC-Routes2 simplifies multi-language routing by:
- Supporting per-language `item mapping
- Allowing deep localization inside components
- Automatically syncing with vue-i18n or other reactive locales
- Simplifying SEO metadata management across languages