Aller au contenu
APPRENDRE

Langues

Les dix langues d'interface et comment en choisir une.

Ce chapitre est disponible en anglais et en bulgare.

Interface languages

The interface of the editor (toolbar, menus, dialogs, messages, panels) comes in ten languages:

CodeLanguage
en-USEnglish (the default)
bg-BGBulgarian
de-DEGerman
fr-FRFrench
es-ESSpanish
pt-BRBrazilian Portuguese
nl-NLDutch
da-DKDanish
sv-SESwedish
nb-NONorwegian Bokmal

Choose the language with UiLanguage:

var options = new RteOptions { UiLanguage = "de-DE" };

The value may be a full code (de-DE) or only the language (de, de-AT); the first pack with the same language is used. no and nn map to Norwegian Bokmal. An unknown language, or English, keeps the English texts. To follow the language of the current user, pass the name of the current culture:

options.UiLanguage = CultureInfo.CurrentUICulture.Name;

The packs are JSON files inside the assembly. Each holds 528 texts and is keyed by the English text, so a text that is missing from a pack falls back to English. The languages other than English and Bulgarian were translated without a native review and have not been read in a browser; please report wrong wording.

Changing single texts

Labels changes texts by key; Texts replaces texts by their English wording:

options.Labels = new() { ["bold"] = "Strong" };
options.Texts = new() { ["Insert block"] = "Add block" };

Labels wins over Texts and the pack. Texts may contain placeholders such as {count}; keep them in your translation. The label keys are the first argument of the t(...) calls in the scripts under wwwroot/js.

Note: when you set Texts yourself, the language pack is not loaded. To change a few texts of a language, start from the pack:

var texts = new Dictionary<string, string>(RteLanguagePacks.Load("de-DE") ?? []);
texts["Insert block"] = "Add block";
options.Texts = texts;

Direction

Direction = RteDirection.Rtl switches the editor to right-to-left. The toolbar has a direction button that changes the direction of the current text.

Spell check

Spellcheck.Language is the language for spell checking and is separate from UiLanguage. The default checker is the one of the browser (Native). A server checker is plugged in through IRteSpellChecker; the default one is only a word list.

Adding a language

To use a language that has no pack, put its texts in Texts (keyed by the English wording) when you create RteOptions. RteLanguagePacks.SupportedLanguages lists the codes that have a pack and RteLanguagePacks.Load(language) returns a pack (or null for English).

← Menus et touchesExport et import →

Prêt à essayer RayCraft Write?

Démarrez l'essai de 14 jours, aucune carte requise.

Démarrer l'essai de 14 jours