Giter Site home page Giter Site logo

Comments (4)

codingseb avatar codingseb commented on June 18, 2024 2

Ok I published :

To allow hot reloading of files and implement the method RaiseLanguageChangeEvents in class Loc.
I also implemented an example of hot reloading in CodingSeb.Localization.Examples.
See :

<Button x:Name="LanguageChangedRefreshButton" 
        DockPanel.Dock="Right"
        Content="Refresh"
        Click="LanguageChangedRefreshButton_Click" />
private void LanguageChangedRefreshButton_Click(object sender, RoutedEventArgs e)
{
    Languages.ReloadFiles();
    Loc.Instance.RaiseLanguageChangeEvents();
}
public static void ReloadFiles()
{
    string exampleFileFileName = Path.Combine(languagesFilesDirectory, "Example1.loc.json");
    LocalizationLoader.Instance.ClearAllTranslations();
    LocalizationLoader.Instance.AddFile(exampleFileFileName);
}

from localization.

codingseb avatar codingseb commented on June 18, 2024 1

Hello again @linhmc
Yes it's a good idea. Thanks for it.

I will include it in Loc.cs as soon as possible and publish a new CodingSeb.Localization version

from localization.

linhmc avatar linhmc commented on June 18, 2024

Hi @codingseb

In Loc.cs class I suggest add method.

public void RaiseLanguageChange()
{
    TMLanguageChangingEventArgs changingArgs = new TMLanguageChangingEventArgs(currentLanguage, currentLanguage);
    TMLanguageChangedEventArgs changedArgs = new TMLanguageChangedEventArgs(currentLanguage, currentLanguage);
    CurrentLanguageChanging?.Invoke(this, changingArgs);
    if (!changingArgs.Cancel)
    {
        CurrentLanguageChanged?.Invoke(this, changedArgs);
    }
}

image

Developer can invoke to update language. Please consider.

from localization.

linhmc avatar linhmc commented on June 18, 2024

Many thanks @codingseb.

from localization.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.