Click here to Skip to main content
15,113,873 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need a suggestion Pin
simpledeveloper15-Jul-21 23:03
Membersimpledeveloper15-Jul-21 23:03 
GeneralRe: Need a suggestion Pin
Richard Deeming15-Jul-21 23:38
mveRichard Deeming15-Jul-21 23:38 
AnswerRe: Need a suggestion Pin
Gerry Schmitz14-Jul-21 20:11
mveGerry Schmitz14-Jul-21 20:11 
AnswerRe: Need a suggestion Pin
Eddy Vluggen15-Jul-21 10:20
professionalEddy Vluggen15-Jul-21 10:20 
AnswerRe: Need a suggestion Pin
Mycroft Holmes15-Jul-21 13:37
professionalMycroft Holmes15-Jul-21 13:37 
GeneralRe: Need a suggestion Pin
simpledeveloper15-Jul-21 22:55
Membersimpledeveloper15-Jul-21 22:55 
AnswerRe: Need a suggestion Pin
jschell17-Jul-21 11:26
Memberjschell17-Jul-21 11:26 
Questionc# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien14-Jul-21 3:55
MemberMaximilien14-Jul-21 3:55 
I'm trying to change the language of our application at runtime.

I already have resx files for the different languages.

When I run this at the application startup it works; the translated (German) strings are displayed in the app.
var cultureInfo = CultureInfo.CreateSpecificCulture("de");
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;

When I try changing the language later on, the language is not updated.

I call the same code in my view with the different language strings (obviously).
var cultureInfo = CultureInfo.CreateSpecificCulture("fr"); // for example if I select french
Thread.CurrentThread.CurrentCulture = cultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureInfo;
CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;

From what I can see That should be enough.

Is there something I'm missing ? Is there a call to update the UI I don't know about ?

Thanks.
CI/CD = Continuous Impediment/Continuous Despair

AnswerRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Richard Deeming14-Jul-21 4:01
mveRichard Deeming14-Jul-21 4:01 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien14-Jul-21 5:38
MemberMaximilien14-Jul-21 5:38 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Richard Deeming14-Jul-21 5:48
mveRichard Deeming14-Jul-21 5:48 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien14-Jul-21 10:35
MemberMaximilien14-Jul-21 10:35 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Richard Deeming14-Jul-21 22:32
mveRichard Deeming14-Jul-21 22:32 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien15-Jul-21 2:11
MemberMaximilien15-Jul-21 2:11 
AnswerRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Gerry Schmitz14-Jul-21 6:20
mveGerry Schmitz14-Jul-21 6:20 
QuestionN-Tier best practices when using in MVC application Pin
Member 949196213-Jul-21 14:33
MemberMember 949196213-Jul-21 14:33 
AnswerRe: N-Tier best practices when using in MVC application Pin
Gerry Schmitz14-Jul-21 6:14
mveGerry Schmitz14-Jul-21 6:14 
QuestionExperiencing Memory Leak and unable to Handle it with GC.Collect() Pin
rahulgorai13-Jul-21 8:35
Memberrahulgorai13-Jul-21 8:35 
AnswerRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
Dave Kreskowiak13-Jul-21 10:41
mveDave Kreskowiak13-Jul-21 10:41 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
rahulgorai14-Jul-21 3:03
Memberrahulgorai14-Jul-21 3:03 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
Dave Kreskowiak14-Jul-21 5:16
mveDave Kreskowiak14-Jul-21 5:16 
GeneralRe: Experiencing Memory Leak and unable to Handle it with GC.Collect() Pin
jschell17-Jul-21 11:37
Memberjschell17-Jul-21 11:37 
Question.Tag File Pin
f6112-Jul-21 20:44
Memberf6112-Jul-21 20:44 
AnswerRe: .Tag File Pin
Victor Nijegorodov12-Jul-21 21:38
MemberVictor Nijegorodov12-Jul-21 21:38 
AnswerRe: .Tag File Pin
Ralf Meier12-Jul-21 21:56
professionalRalf Meier12-Jul-21 21:56 

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

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