Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Globalization in WPF

0.00/5 (No votes)
17 Jun 2014 2  
Create a multilingual application WPF

Introduction

How can we create a multilingual application in WPF?

Background

This code is developed in VS2012.

Using the Code

Create a new WPF Application Project. By default, you will get App.xaml & MainWindow.xaml forms.

1

Now create a new ClassLibrary project in the same solution for resource files. You can also create resource files in the same project.

And add Resource files in that ClassLibrary. I have added 2 in my project named as Language.resx (for English) and Language.de-DE.resx (for German). Mention your lables, buttons, etc. translations in those files. And make the Access Modifier as PUBLIC

Build your class Library and add reference in WPF project.

Now open App.xaml code behind and write the below lines in default constructor:

By default, I have mentioned de-DE as culture. For English, you can leave it blank.

Now open MainWindow.xaml and design the page as per your requirement. But add the namespace of class library in Window tag as per below:

Now bind the controls as per their content, as per below screen:

And now run the application. That's it................enjoy programming.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here