From 359152c8d1b1d39f6d05ce179904ba715ba4c3a3 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Thu, 11 Oct 2018 20:32:48 +0200 Subject: [PATCH] i18n Python scripts: fix Translation.__setitem__() and add docstrings Translation.__setitem__() from flightgear/meta/i18n.py isn't used anywhere here (it is not very useful), so no harm done, but that could have confused potential readers. --- python3-flightgear/flightgear/meta/i18n.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/python3-flightgear/flightgear/meta/i18n.py b/python3-flightgear/flightgear/meta/i18n.py index 0c50166..9f63c81 100644 --- a/python3-flightgear/flightgear/meta/i18n.py +++ b/python3-flightgear/flightgear/meta/i18n.py @@ -577,10 +577,25 @@ class Translation: return ''.join(l) def __getitem__(self, cat): + """Get all translations for a given category. + + Return a mapping where each key is a tid (instance of a subclass + of AbstractTranslationUnitId) and each value a TranslationUnit + instance. + + """ return self.translations[cat] - def __setitem__(self, cat, translUnit): - self.translations[cat] = translUnit + def __setitem__(self, cat, mapping): + """Replace all translations for a given category. + + cat: a category name (string such as 'sys', 'options', etc.) + mapping: a mapping where each key is a tid (instance of a + subclass of AbstractTranslationUnitId) and each value a + TranslationUnit instance. + + """ + self.translations[cat] = dict(mapping) def __iter__(self): return iter(self.translations)