1
Vote

Add method for reloading strings after culture change

description

Hi,
I use in my app functionality for switching the selected culture/language on the fly. For this I had to change the ResourceLoader logic. It would be great to have this functionality built in.
Here's a sample what I use in the code-behind for AboutResources:
private static ResourceLoader resourceLoader;
private static string resourcesName;
        
static AboutResources()
{
    string executingAssemblyName;
    executingAssemblyName = Windows.UI.Xaml.Application.Current.GetType().AssemblyQualifiedName;
    string[] executingAssemblySplit;
    executingAssemblySplit = executingAssemblyName.Split(',');
    executingAssemblyName = executingAssemblySplit[1];
    string currentAssemblyName;
    currentAssemblyName = typeof(AboutResources).AssemblyQualifiedName;
    string[] currentAssemblySplit;
    currentAssemblySplit = currentAssemblyName.Split(',');
    currentAssemblyName = currentAssemblySplit[1];
    if (executingAssemblyName.Equals(currentAssemblyName))
    {
        resourcesName = "AboutResources";
    }
    else
    {
        resourcesName = currentAssemblyName + "/AboutResources";
    }
    resourceLoader = ResourceLoader.GetForCurrentView(resourcesName);
}

public static void Reset()
{
    resourceLoader = ResourceLoader.GetForCurrentView(resourcesName);
}

comments