Issue #139 resolved

Localize.json getting changed unnecessarily

Jens Alfke
repo owner created an issue

The file Localize.json keeps getting modified even though I haven’t touched any localized resources. The diffs are no-ops, simply reordered lines.

The script that’s writing this file should write the dictionary entries into some canonical order, since otherwise of course the order they appear is unspecified/random. Or alternatively, it could compare the new dictionary object with the old one and only rewrite the file if they're unequal.

Here's what the current diff in my working tree looks like:

{{{ @@ -1,8 +1,8 @@ { "French.lproj/Repo.strings": "1c882f55c1bc1e7629827090aae1f4ed", + "French.lproj/Projects.strings": "7f3632a7668f39432d8dbf4ffb770f55", + "German.lproj/FileViewer.strings": "3180f066f393da424f8f32f60384cedf", "English.lproj/Projects.xib": "770fab372e314ce3a66f4c501d11d8ee", - "German.lproj/MainMenu.strings": "aa69dae50fd262857497ba56606ac537", - "German.lproj/FileViewer.strings": "3180f066f393da424f8f32f60384cedf", "English.lproj/FileViewer.xib": "89b3ce19501369084592522616927d3e", "English.lproj/MainMenu.xib": "5694c0d6ed650beedcc67cd306882d32", "German.lproj/Projects.strings": "8554bdd35568c0d598d3f5b322836067", @@ -10,5 +10,5 @@ "French.lproj/MainMenu.strings": "d54b312e76454c8742206c78acb4a7e8", "English.lproj/Repo.xib": "a4a63e8d9fa77bc29977ba5ff7ae162d", "French.lproj/FileViewer.strings": "3180f066f393da424f8f32f60384cedf", - "French.lproj/Projects.strings": "7f3632a7668f39432d8dbf4ffb770f55" + "German.lproj/MainMenu.strings": "aa69dae50fd262857497ba56606ac537" } }}}

Comments (2)

  1. David Keegan

    Ah I missed the "sort_keys" flag on the json dump call.

    Changing line 214 to this should fix this issue:

    json.dump(jsonData, localizeData, sort_keys=True, indent=4)

    I'll try this out tonight but it should be that easy.

  2. Log in to comment