Table of Contents
  • Getting Started
  • EO.Pdf
  • EO.Web
  • EO.WebBrowser
  • EO.Wpf
    • Overview
    • Installation & Deployement
    • Skin & Theme
    • Common Taskes and Services
    • EO.Wpf Buttons
    • EO.Wpf Calendar & DatePicker
    • EO.Wpf ComboBox
    • EO.Wpf DockView
    • EO.Wpf Gauge
    • EO.Wpf ListBox
    • EO.Wpf Menu
    • EO.Wpf MaskedEdit
    • EO.Wpf ProgressBar
    • EO.Wpf Slider
    • EO.Wpf SpinEdit
    • EO.Wpf SplitView
    • EO.Wpf TabControl
    • EO.Wpf TreeView
    • EO.Wpf Utility Controls
    • EO.Wpf WindowChrome
    • Sample Data Objects
  • Common Topics
  • Reference
Localizing EO.Wpf Controls

Some EO.Wpf controls use string literals. For example, a DockView control displays tooltip text "Close" for the close button. EO.Wpf.dll has built-in translation for a number of languages. You can also redefine these strings for your own language.

Using Built-in Translations

EO.Wpf.dll has built-in translation for the following languages:

Language UICulture value
Arabic ar/ar-XX
Chinese (simplified) zh-CN
Chinese (traditional) zh-TW/zh-HK/zh-MO
Danish da/da-XX
Dutch nl/nl-XX
English en/en-XX
Finnish fi/fi-XX
French fr/fr-XX
German de/de-XX
Greek el/el-XX
Hebrew he/he-XX
Hindi hi/hi-XX
Hungarian hu/hu-XX
Italian it/it-XX
Norwegian no/no-XX
Polish pl/pl-XX
Portuguese pt/pt-XX
Spanish es/es-XX
Swedish sv/sv-XX

Where "XX" are possible language variations. For example, both "fr-FR" (France) and "fr-CA" (Canada) will load the French translation.

If your system language matches one of these languages, then EO.Wpf will automatically load the translation for that language. You can explicitly override this behavior in your code by setting EO.Wpf.Runtime.UICultureName property. For example, the following code explicitly set all EO.Wpf controls to use the French string table:

//Switch UI language to French
EO.Wpf.Runtime.UICultureName = "fr";

Custom Translations

All string literals can also be refined. So if EO.Wpf.dll does not have a built-in translation for your local language, or you wish to change the built-in translation, you can translate and redefine the corresponding string in your resource dictionary.

The following XAML demonstrates this behavior:

XAML
<Window x:Class="Test.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:eo="clr-namespace:EO.Wpf;assembly=EO.Wpf" 
        Title="Window1" 
        Height="300" 
        Width="350">
    <eo:DockContainer>
        <eo:DockView></eo:DockView>
    </eo:DockContainer>
</Window>

Run the above code, then move mouse over to the DockView's close button, a small tooltip "Close" (in an English system) is displayed:

To replace text "Close", you must redefine a resource item with key EOSTR_Close with the new text. For example, the following code replaces the text with its Spanish version in App.xaml:

XAML
<Application x:Class="Test.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             StartupUri="Window1.xaml">
     <Application.Resources>
        <sys:String x:Key="EOSTR_Close">Cerrar</sys:String>
    </Application.Resources>
</Application>

Note that the above XMAL added prefix "sys" in order to reference System.String type:

XAML
xmlns:sys="clr-namespace:System;assembly=mscorlib"

Run the code again, notice the tooltip text is "Cerrar" now:

The resource can also be defined on the Window level:

XAML
<Window x:Class="Test.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:eo="clr-namespace:EO.Wpf;assembly=EO.Wpf" 
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        Title="Window1" 
        Height="300" 
        Width="350">
    <Window.Resources>
        <sys:String x:Key="EOSTR_Close">Cerrar</sys:String>
    </Window.Resources>
    <eo:DockContainer>
        <eo:DockView></eo:DockView>
    </eo:DockContainer>
</Window>

In that case, the localized version is only applied to controls in that Window instead of for the whole application.

The following table contains the resource key for all string literals used by EO.Wpf:

Resource Key Text
EOSTR_AutoHide Auto Hide
EOSTR_Cancel Cancel
EOSTR_Close Close
EOSTR_Clear Clear
EOSTR_Dock Dock
EOSTR_DockAsTabbedDocument Dock as Tabbed Document
EOSTR_ExpandBottomPane Expand Bottom Pane
EOSTR_ExpandLeftPane Expand Left Pane
EOSTR_ExpandRightPane Expand Right Pane
EOSTR_ExpandTopPane Expand Top Pane
EOSTR_Maximize Maximize
EOSTR_More More
EOSTR_NewTab New Tab
EOSTR_OK OK
EOSTR_Restore Restore
EOSTR_SelectUnselectAll Select/Unselect all
EOSTR_SwapPanes Swap Panels
EOSTR_VerticalSplit Vertical Split
EOSTR_HorizontalSplit Horizontal Split
EOSTR_WindowPosition >Window Position