zHaytam / EasyLocalization

A simple library that makes WPF Localization easier
MIT License
22 stars 6 forks source link

Can it be refreshed method #2

Open visualczm opened 3 years ago

visualczm commented 3 years ago

Hi zHaytam,

 LocalizationManager.Instance.CurrentCulture = CultureInfo.GetCultureInfo("zh-CN");
//Whenever the CurrentCulture changes, the whole application is automatically updated without the need to restart it.

Can it be refreshed method? Because I re-edited the text, but did not change the language Or what to do

This project helped me a lot, thank you~

zHaytam commented 3 years ago

Hello,

I'm sorry this project was just me trying things out, and I assume you cloned it and added it in your solution right? If that's the case, you can go ahead and add a method in LocalizationManager called Refresh like so:

public void Refresh()
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CultureInfo)));
}

This should help you!

visualczm commented 3 years ago

@zHaytam thank you lot.is help me !!!

but example not work .

public void Refresh()
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CultureInfo)));
}

fix i.E:

public void Refresh()
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("CurrentCulture"));
}