From 5a102b3e5fa75f50beab6ae93848843a4f8ebf81 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 26 Jun 2022 13:12:58 -0400 Subject: [PATCH] Fix #334. This fixes #334 by sorting everything before writing it out to the localization file. Note that we need to sort each step along the way because the nested dicts are not sorted by a call to `sorted()` - it appears to only sort the key. --- korman/exporter/locman.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/korman/exporter/locman.py b/korman/exporter/locman.py index 13418b7..cca4680 100644 --- a/korman/exporter/locman.py +++ b/korman/exporter/locman.py @@ -150,7 +150,7 @@ class LocalizationConverter: def iter_element(element): if language_name is None: - yield from element.items() + yield from sorted(element.items()) else: yield language_name, element @@ -160,9 +160,9 @@ class LocalizationConverter: write_line("") write_line("", self._age_name, indent=1) - for set_name, elements in sets.items(): + for set_name, elements in sorted(sets.items()): write_line("", set_name, indent=2) - for element_name, value in elements.items(): + for element_name, value in sorted(elements.items()): write_line("", element_name, indent=3) for translation_language, translation_value in iter_element(value): if _ESHTML_REGEX.search(translation_value):