Fixed a wrong locale string

This commit is contained in:
Raphael Michel
2016-03-15 17:09:04 +01:00
parent 108b518a50
commit 8812da5325
2 changed files with 6 additions and 3 deletions

View File

@@ -37,10 +37,13 @@ class LazyI18nString:
This will rather return you a string in a wrong language than give you an
empty value.
"""
return self.localize(translation.get_language())
def localize(self, lng):
if self.data is None:
return ""
if isinstance(self.data, dict):
lng = translation.get_language()
firstpart = lng.split('-')[0]
similar = [l for l in self.data.keys() if l.startswith(firstpart + "-")]
if lng in self.data and self.data[lng]: