The library contains three namespaces:
  • LukasKopenec.LocalizationSupport that contains the two markup extensions, the localization manager implementation and an interface for resource providers.
  • LukasKopenec.LocalizationSupport.Providers containing an implementation of a resource file provider
  • LukasKopenec.LocalizationSupport.Converters that contains an implementation of a converter from an image resource in a resx resource file to an image source value


This class is nearly exactly the same as the one given on WPF Tutorial.
LocalizeExtension(String key)

Key (String) - Gets or sets the key of the localized resource
Format (String) - Gets or sets the format string used to format the value (optional)
DefaultValue (object) - Gets or sets the value that is used if the key was not found (optional)
Converter (IValueConverter) - Gets or sets the value converter that is used to convert the value

Examples of use
<TextBlock Text="{Localize Text}"/>
<Label Content="{Localize Label,DefaultValue=Name:}"/>
_<Image Source="{Localize Picture,Converter=BitmapImageToImageSourceConverter}"/>


This class inherits from LocalizeExtension so it has all its properties, in addition it has
PropertyName (String) - Gets or sets the name of the target property (The property whose value is being set by this extension instance).

ReflectedLocalizeExtension(String key,String propertyName)

Examples of use
<RibbonCommand LabelTitle={ReflectedLocalize Ribbon.Open,LabelTitle}/>

How to set-up the library

public partial class App : Application
        protected override void OnStartup(StartupEventArgs e)

            ResourceFileProvider provider = new ResourceFileProvider(
                "Localizations.Resources",                       // Base for the resource manager.
                Assembly.LoadFrom("Localizations.dll"));         // This the assembly that contains the Resources.resx file

            CultureInfo defaultCulture = new CultureInfo("en-US");
            LocalizationManager.SupportedCultures.Add(defaultCulture, provider);
            LocalizationManager.SupportedCultures.Add(new CultureInfo("cs-CZ"), provider);
            LocalizationManager.CurrentCulture = defaultCulture;

Last edited Jul 29, 2009 at 4:54 PM by Luk, version 1


No comments yet.