Everything in 2sxc is multi-language right from the start. It's important to understand that every field in 2sxc can be translated or not - and the lookup happens automatically. So the following examples will automatically show the correct value based on the language you're on.
There are two important types of multi-language:
If you installed the Tutorial App on your system these examples may not work. That's because Dnn / 2sxc must be have DE and EN activated before installing the tutorial app. Otherwise it will only import the EN data and not import the DE data.
These are configured in the App Resources or in the global resources.
Welcome to the Tutorial App!
This is the English greeting 😉!
@inherits Custom.Hybrid.Razor14 <ol> <li>The Greeting Text: <br> @Html.Raw(App.Resources.Get("Greeting")) </li> <li> A button: <button type="button">@App.Resources.Get("ButtonOrder")</button> </li> </ol>
The editor can edit anything and choose which field to translate. In the following example, only one book is translated - and even the cover-image is translated.
@inherits Custom.Hybrid.Razor14 @using ToSic.Razor.Blade @{ // Resize settings for the cover images var flatSettings = Kit.Image.Settings(width: 100, height: 300, resizeMode: "max", scaleMode: "both"); } <ul> @foreach (var book in AsList(App.Data["Books"])) { <li class="mb-4"> <div style="overflow: auto"> @if (Text.Has(book.Cover)) { @Kit.Image.Img(book.Cover, settings: flatSettings, imgClass: "float-start pe-4") } <strong>@book.Title</strong> <br> @Text.Ellipsis(book.Teaser, 100, suffix: "…") </div> </li> } </ul>