Thursday, 14 April 2016

XML : Write resx-file from Dicitionary

I'm trying to build a tool which will help me translate my application.

In first step I read my resource into a IDictionary<string, string> using

  MyResource.ResourceManager.GetResourceSet(CultureInfo.InvariantCulture, true, false).Cast<DictionaryEntry>().ToDictionary(entry => (string)entry.Key, entry => (string)entry.Value)    

After this, there is many more logic to find translateable parts in my application which may add, delete or modify key/values in the dictionary.

However. At the end, the dictionary is may 'new' resource to be used. Question: How to convert my dictionary back to a valid Resx-file?

Are there any built-in functions to do so? Or do I have to write the plain file looping through the dictionary by myself?

No comments:

Post a Comment