Skip to content

Instantly share code, notes, and snippets.

@bricelam
Created December 14, 2016 05:37
Show Gist options
  • Save bricelam/7b3413669c509c5a85ffa3435336cdae to your computer and use it in GitHub Desktop.
Save bricelam/7b3413669c509c5a85ffa3435336cdae to your computer and use it in GitHub Desktop.
Normalize .resx files
using System.Collections;
using System.IO;
using System.Linq;
using System.Resources;
class Program
{
static void Main(string[] args)
{
var reader = ResXResourceReader.FromFileContents(File.ReadAllText(args[0]));
var writer = new ResXResourceWriter(args[0]);
foreach (var entry in reader.Cast<DictionaryEntry>().OrderBy(e => e.Key))
writer.AddResource((string)entry.Key, entry.Value);
writer.Generate();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment