Click here to Skip to main content
Click here to Skip to main content
Go to top

Globalization in WPF

, 17 Jun 2014
Rate this:
Please Sign up or sign in to vote.
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Vipul Bhatnagar
Technical Lead
India India
Having working experience of 8+ Years in IT , major experience is in Banking/Finance , Engineering, e-Commerce web development.
Worked with .NET, SharePoint. Having good command on SharePoint 2010, ASP.NET with C# , C#, VB.NET, Ajax, JavaScript, WPF, Web Services, Window Services, MS SQL Server.

Comments and Discussions

 
QuestionLanguage change at runtime? PinmemberMaximilian Haru Raditya19-Jun-14 9:33 
AnswerRe: Language change at runtime? PinmemberVipul Bhatnagar19-Jun-14 19:22 
QuestionThanks PinmemberKapul Kumar Bhatnagar18-Jun-14 20:13 
GeneralThanks for valuable feedback PinmemberVipul Bhatnagar18-Jun-14 3:07 
QuestionThanks! PinmemberTokinabo18-Jun-14 2:22 
GeneralMy vote of 4 PinmemberLusvardi Gianmarco (Jymmy097)17-Jun-14 2:27 
GeneralNice article PinmemberMember 803348217-Jun-14 2:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 17 Jun 2014
Article Copyright 2014 by Vipul Bhatnagar
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid