It is possible to export my current resource dictionary as string? I wish I could export a merged dictionary containing all of the strings of the user chooses to translate my app for example.
I know that I can access informations about my app's resources at Application.Current.Resources.MergedDictionaries
. Each dictionary contains a Original string pointing to Resources/Localization/[name].xaml
But how could I access the contents of this resource to export as string?
I've made it!
To save a Resource Dictionary
as a file, I just needed 2 lines of code:
using (StreamWriter writer = new StreamWriter(XamlFileName))
XamlWriter.Save(Application.Current.Resources.MergedDictionaries[6], writer);
In my case, I wanted to save only one of my Resource Dictionary
.
Now, the only issue is that the text file isn't formatted. :/