TX Text Control .NET for WPF

Localization and Resource Kit

Topic

Which language do the dialog boxes and messages of TX Text Control .NET for WPF speak? English or German, depending on the language of the system, and any other language for which you build a satellite assembly with the Resource Kit. Read on for the German resources in the NuGet package, the Resource Kit steps, and the ResourceProvider calls that give your own WPF controls the ribbon's texts and icons in a chosen language.

Only the user interface is meant here. The language of the document text, which spell checking uses, is a formatting attribute set with LanguageDialog or in code; see Spell Checking.

English, German and Satellite Assemblies

The built-in dialog boxes and the error strings of TX Text Control are .NET string resources. English is built into the assemblies. German comes as satellite assemblies, assemblies that hold only the resources of one language, in the folder lib/net8.0/de of the package TXTextControl.TextControl.WPF.SDK:

  • TXTextControl.resources.dll for TXTextControl.dll
  • TXDocumentServer.resources.dll for TXDocumentServer.dll
  • TXDrawing.resources.dll for TXDrawing.dll
  • TXBarcode.resources.dll for TXBarcode.dll

The English and German resources are fixed; other languages are added, not changed.

The language is chosen by the current system language, the same way .NET chooses the language of its own file dialog boxes. With a German system language and the folder de next to the TX Text Control assemblies, the dialog boxes and messages are German. For a language without a satellite assembly, they stay English, and a satellite assembly for another language, such as French, is loaded only on a system whose language is French.

The texts of the ribbon are resources too. ResourceProvider returns them in the language you pass, as the last section shows.

Deploy the Folder de

The build copies de into the output directory of a .NET project. Ship it in the same place:

<application folder>\YourApplication.exe
<application folder>\TXTextControl.dll
<application folder>\TXTextControl.WPF.dll
<application folder>\de\TXTextControl.resources.dll
<application folder>\de\TXDocumentServer.resources.dll
<application folder>\de\TXDrawing.resources.dll
<application folder>\de\TXBarcode.resources.dll

A deployment without this folder shows English dialog boxes on German systems too. Managed Assemblies and Native Libraries describes the other files.

Build a Satellite Assembly With the Resource Kit

The setup installs the Resource Kit in the ResourceKit folder of the installation directory, as Installing the Product lists. Its files:

FileContents
TextControl.resxThe built-in resources in XML. The texts are the contents of the value elements
buildres.batCalls the command line tools of the .NET Framework SDK that build the satellite assembly
txtextcontrol.public.snkThe public key of TX Text Control, which the build needs

A 2025 blog article, Changing the Language in the Angular Document Editor Using the Resource Kit, shows that TextControl.resx also holds ribbon texts such as the name of the Reporting tab, and that other .resx files such as TXBarcode.resx can be translated the same way.

To build and install a French satellite assembly:

  1. Install the .NET Framework SDK.

  2. Translate the contents of the value elements in TextControl.resx. Leave the resource names unchanged.

  3. In the ResourceKit folder, run the batch file with the ISO 639 two-letter code:

    .\buildres.bat fr
    

    The result is txtextcontrol.resources.dll.

  4. In the application folder that holds the TX Text Control files, create the subfolder fr and copy the file into it.

  5. On every machine, create the registry key that lets the .NET Framework use your own build of the satellite assembly:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\txtextcontrol.resources,6B83FE9A75CFB638
    

    For a 32-bit application on 64-bit Windows, add it below HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\StrongName\Verification as well. Satellite assemblies of TXBarcode, TXDocumentServer and TXDrawing get keys of the same form, such as TXDrawing.resources,6B83FE9A75CFB638.

These steps come from the documentation of the Resource Kit, which is written for the .NET Framework: the SDK tools and the registry key both belong to it. No source describes a separate procedure for .NET 8 or higher. The .NET Framework case of a WPF application is covered in Deploying .NET Framework Applications.

Texts and Icons for Your Own Controls

The text methods of the ResourceProvider, listed in Give Your Buttons the Built-in Icons, take the identifier of a ribbon item and an optional CultureInfo for the language of the result.

Icons can depend on the language as well. TXITEM_Bold, TXITEM_Italic and TXITEM_Underline have small icons for English, French, German and Spanish, selected by the Culture property of ImageSourceSettings. The default culture is CultureInfo.CurrentUICulture; a culture without its own icon gets the English one.

A toggle button in MainWindow.xaml:

<ToggleButton x:Name="boldButton" Width="24" Height="24" />

gets the French icon and the tooltip of the ribbon's bold button in MainWindow.xaml.cs:

using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using TXTextControl.WPF;

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        Loaded += MainWindow_Loaded;
    }

    private void MainWindow_Loaded(object sender, RoutedEventArgs e)
    {
        CultureInfo french = new CultureInfo("fr");
        string identifier = RibbonFormattingTab.RibbonItem.TXITEM_Bold.ToString();

        ResourceProvider.ImageSourceSettings settings = new ResourceProvider.ImageSourceSettings();
        settings.Culture = french;

        boldButton.Content = new System.Windows.Controls.Image { Source = ResourceProvider.GetSmallIcon(identifier, this, settings) };
        boldButton.ToolTip = ResourceProvider.GetToolTipTitle(identifier, french);
    }
}

The code works as follows:

  • RibbonFormattingTab.RibbonItem lists the items of the formatting tab; ToString turns a value into the identifier.
  • ImageSourceSettings.Culture selects the French bold icon, and GetSmallIcon creates it as a BitmapSource in the resolution of the window.
  • GetToolTipTitle returns the title of the tooltip in French only if a French satellite assembly built with the Resource Kit is deployed; otherwise it returns the English title.

Next Steps