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.
This commit is contained in:
parent
2c41742b99
commit
359152c8d1
1 changed files with 17 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue