# Multilingual Documents and Language Scopes

> Check documents in several languages in Windows Forms: one dictionary per language, Selection.Culture in TextControl, Check with CultureInfo and suggestions.

- **Product:** TX Spell .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Spell .NET for Windows Forms > Dictionaries and Languages > Multilingual Documents and Language Scopes
- **1935 words**
- **Web URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/multilingual/
- **LLMs URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/multilingual/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/multilingual/llms-full.txt

---

A contract with an English and a German version side by side, a letter that quotes a French source, a manual translated paragraph by paragraph: many documents mix languages. TX Spell .NET checks them in all of their languages at once, with one dictionary per language, and checks each piece of text against the dictionaries of its own language when that language is known. The key is how a text gets its language, in TX Text Control and in code.

### How Text Gets a Language

In TX Text Control, a language belongs to the text itself: a single character, a word or whole paragraphs can have one. The text gets its language in three ways:

- **From the keyboard.** When the user switches the keyboard language in Windows, the text typed next gets that language.
- **From a dialog or the ribbon.** The **Language** group of the ribbon's **Proofing** tab sets the language of the selected text.
- **From your code**, through the culture of the selection or of a style, as shown below.

The **Language** dialog of TX Text Control sets the language of the selected text from a list of languages. Your code opens it with [LanguageDialog](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/languagedialog-method/llms-full.txt):

![The Language dialog of TX Text Control over an invoice in TX Text Control Words, with German (Germany) selected in the list of languages.](https://docs.textcontrol.com/assets/img/tx-spell-dotnet-winforms/language-dialog.f416ffd9.webp)

A document loaded from a file keeps the languages stored in it; documents of TX Text Control and Microsoft Word store them. The status bar shows the language at the input position, here English in the first sentence and Spanish in the second:

![TX Text Control Words with the sentence "This is an US English language region. This is a Spanisch region.": the status bar shows English (United States) in the first sentence and Spanish (United States) in the second.](https://docs.textcontrol.com/assets/img/tx-spell-dotnet-winforms/language-region-status-bar.f414a837.webp)

With TX Spell .NET connected, TX Text Control passes the language of each word to the spell checker, which uses the dictionaries of that language for checking and for suggestions, and the hyphenation list of that language for hyphenation.

### Load One Dictionary per Language

For each language of your documents, add its dictionary to [Dictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/dictionaries-property/llms-full.txt). The English dictionary is loaded by default; this adds German:

```csharp
txSpellChecker1.Dictionaries.Add(new TXTextControl.Proofing.OpenOfficeDictionary("de_DE_frami.dic"));
```

The dictionary takes its language from its file name, here German (Germany). [Loading and Managing Dictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/managing/llms-full.txt) covers where the files go and how to load them; [Hunspell and OpenOffice Dictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/hunspell/llms-full.txt) lists the languages Text Control offers.

### Set the Language of Text in Code

The [Culture](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/culture-property/llms-full.txt) property of the selection sets the language of the selected text. This handler marks the selection as German, for example from a menu item of your application:

```csharp
private void menuItemGerman_Click(object sender, EventArgs e)
{
    // Check, hyphenate and suggest the selected text as German (Germany)
    textControl1.Selection.Culture = new System.Globalization.CultureInfo("de-DE");
}
```

The code works as follows:

- [Selection](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/selection-property/llms-full.txt) is the selected text, or the input position when nothing is selected.
- `Culture` set to `null` gives the text a neutral language, which means no specific language.
- Reading `Culture` of a selection that spans several languages returns the default value; [IsCommonValueSelected](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/iscommonvalueselected-method/llms-full.txt) tells whether the selection has one language.

A style can carry a language as well: the [Culture](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/formattingstyle/culture-property/llms-full.txt) property of a formatting style gives every text of that style its language.

### Check a String in One Language

Outside TX Text Control, a string has no language. [Check](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/check-method/llms-full.txt) then checks it against all enabled dictionaries, and a word counts as correct if any of them knows it. To check a string in one language, pass the language as the second argument:

```csharp
using System.Globalization;

string text = "This sentense has a mistake. Dieser Satz hat einen Fehlr.";

// Every enabled dictionary: English and German words are accepted
txSpellChecker1.Check(text);

// German only: the English words are reported, too
txSpellChecker1.Check(text, new CultureInfo("de-DE"));
```

With the English and the German dictionary loaded, the two calls find different words:

```text
Check(text):          sentense, Fehlr
Check(text, "de-DE"): This, sentense, has, mistake, Fehlr
```

With a language, `Check` uses the dictionaries of that language in the collection and those of the default dictionary folder. Each word it reports has the language in its [Language](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/incorrectword/language-property/llms-full.txt) property; without a language, the property is `null`. [CreateSuggestions](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/txspellchecker/createsuggestions-method/llms-full.txt) takes a language the same way, so the suggestions for a German word come from German dictionaries. [Incorrect Words and Suggestions](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/suggestions/llms-full.txt) describes both methods.

In TX Text Control, a misspelled word carries the language of its text in the [Culture](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/misspelledword/culture-property/llms-full.txt) property of the `MisspelledWord`.

### Offer Suggestions per Language

The spell check dialog shows the language of the current word in its first line and takes the suggestions from the dictionary chosen in its **Suggestions Dictionary** list. When a text has no language, the dialog shows "No language set":

![The Spelling dialog over TX Text Control Words with the misspelled word "doucment": the first line reads Misspelled word - Language: No language set, and the Suggestions Dictionary list shows en_US.](https://docs.textcontrol.com/assets/img/tx-spell-dotnet-winforms/spell-check-dialog-4k.88078c02.webp)

Two settings help users with several languages:

- **An "All" entry.** Set [IsAllItemEnabled](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/suggestiondictionarycombobox/isallitemenabled-property/llms-full.txt) of the dialog's [SuggestionDictionaryComboBox](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellcheckdialog/suggestiondictionarycombobox-property/llms-full.txt) to `true`, and the list offers an entry that takes suggestions from all dictionaries at once, when more than one provides suggestions.
- **A matching list in your own interface.** The [SuggestionDictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/reference/txtextcontrol-proofing/spellingcorrectionuiprovider-suggestiondictionarieshandler/suggestiondictionaries-property/llms-full.txt) of the correction UI provider hold the dictionaries in the language of the current word; [Spelling Correction Modes and UI Provider](https://docs.textcontrol.com/tx-spell-dotnet-winforms/spell-checking/correction-modes/llms-full.txt) binds a list to them.

### Find the Languages of a Text

Text without a language, such as plain text or a document from an application that stores no languages, is checked against all dictionaries. Language detection can assign the languages instead: it splits a text into *language scopes*, sections of one language each, and TX Text Control can apply them to all text with a neutral language. [Language Detection](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/language-detection/llms-full.txt) shows how.

### Next Steps

- [Language Detection](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/language-detection/llms-full.txt): detect the languages of a text and turn on detection in TX Text Control.
- [Loading and Managing Dictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/managing/llms-full.txt): add the dictionaries of your languages.
- [Right-to-Left Languages](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/right-to-left/llms-full.txt): Arabic, Hebrew, Persian and Urdu.

---

## Nearby

- **Previous:** [User Dictionaries](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/user/llms-full.txt)
- **Next:** [Language Detection](https://docs.textcontrol.com/tx-spell-dotnet-winforms/dictionaries/language-detection/llms-full.txt)
