Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9006251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:21:38+00:00 2026-06-16T01:21:38+00:00

I want to create a Software, where the User can choose between several Languages.

  • 0

I want to create a Software, where the User can choose between several Languages.

As a start i want to learn how to handle Internationalization, since i have never done that before.

As IDE i use SharpDevelop or #develop, however you would spell it.
I want to use C# and WPF, since i’m also learning XAML/WPF at the moment.

So i create a new WPF-Project in ShardDevelop.
On the Main Window i create a ComboBox and a TextBlock.

The ComboBox get’s two Entries: “German” and “English”.
The textBlock should show “Hallo Welt!” or “Hello World!”, depending on the Language which is selected.

Now comes the part where i get stuck.
I guess each language get’s a separate file in XML/XAML-Style (Makes sense).
Where are these files and how are they and their Content loaded so that the Text of the selected Language is loaded?

I found several examples but all are something about creating Resource-DLL and using some weird program to decompile them back into a csv-file… i don’t get it, isn’t there an easier way?


I took the next Step.
The Text of the TextBlock is now loaded via “{StaticResource Strings.MainForm.hwText}”. It looks like this now:

<TextBlock Text="{StaticResource Strings.MainForm.hwText}" />

Also I created one ResourceDictionary for German and one for English which both define the key i used in the TextBlock.

In the Application.Resources Part i load one of the ResourceDictionary’s per default.

The Problem now is: How can i “unload” this Dictionary during Runtime and Replace it with the other?

Of course i use the SelectionChange-Event of the ComboBox, but what do i do there?


Problem solved!! Thanks to kmatyaszek

Although i changed the Code of the Event-Handler a bit to my needs:

Uri baseUri = new Uri(AppDomain.CurrentDomain.BaseDirectory);
Uri uri = new Uri(baseUri,"Languages\\lang."+((sender as ComboBox).SelectedItem as ComboBoxItem).Tag.ToString()+".xaml");
if(File.Exists(uri.LocalPath) || File.Exists((uri = new Uri(baseUri,"Languages\\lang.de-DE.xaml")).LocalPath)){
    ResourceDictionary dict = new ResourceDictionary();
    dict.Source = uri;
    this.Resources.MergedDictionaries.Add(dict);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:21:40+00:00Added an answer on June 16, 2026 at 1:21 am

    If you created two ResourceDictionary files you can binding by DynamicResource.

    Example:

    First resource file (Lang.en-US.xaml):

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:system="clr-namespace:System;assembly=mscorlib">
    
        <system:String x:Key="Username">Username:</system:String>
        <system:String x:Key="Password">Password:</system:String>
        <system:String x:Key="close">Close</system:String>
        <system:String x:Key="login">Login</system:String>        
    </ResourceDictionary>
    

    Second resource file (Lang.pl-PL.xaml):

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:system="clr-namespace:System;assembly=mscorlib">
    
        <system:String x:Key="Username">Login:</system:String>
        <system:String x:Key="Password">Hasło:</system:String>
        <system:String x:Key="close">Zamknij</system:String>
        <system:String x:Key="login">Zaloguj</system:String>
    </ResourceDictionary>
    

    Set default language in Application resources:

     <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="Lang.en-US.xaml" />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
     </Application.Resources>
    

    Let’s say that we have ComboBox like below:

    <ComboBox Name="cbLang" Margin="2" SelectionChanged="cbLang_SelectionChanged" >
                    <ComboBoxItem Content="English" Tag="en-US" />
                    <ComboBoxItem Content="Polish" Tag="pl-PL" />
      </ComboBox>
    

    Code-behind SelectionChanged:

     private void cbLang_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
            {
                ResourceDictionary dict = new ResourceDictionary();
    
                switch (((sender as ComboBox).SelectedItem as ComboBoxItem).Tag.ToString())
                {
                    case "en-US":
                        dict.Source = new Uri("Lang.en-US.xaml", UriKind.Relative);
                        break;
                    case "pl-PL":
                        dict.Source = new Uri("Lang.pl-PL.xaml", UriKind.Relative);
                        break;
                    default:
                        break;
                }
                this.Resources.MergedDictionaries.Add(dict);
            }
    

    And you can binding like this:

     <TextBlock Text="{DynamicResource Username}" VerticalAlignment="Center" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have detachable controls in my software where a user can drag
I want to create a new software that can be controlled by email. It
Basically I want to create an excel management software, where clients can save their
I want create wordpress website into which I want create user management... That means
I want create an application with animate button? how can i do? after click
i want create image animation , i have 50 images with png format now
To protect software, you can create a validation system which requires users to provide
Does MySQL have a user profile system where I can associate permissions and rights
I want to create an architecture diagram to explain our Software (libraries, Eclipse RCP,
My company has many products, we want to create a registry key Software\$(var.Manufacturer) that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.