diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-23 10:21:53 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-23 10:21:53 +0100 | 
| commit | e0f043c751fd59912ed36611adfcc7a7ce4ae15c (patch) | |
| tree | 98f6fccc22dc283a84d0271a26546b03b3073d2b /ishtar_common/models.py | |
| parent | f5cd3193e7ab86a93f2e2159fb4719f17c983991 (diff) | |
| download | Ishtar-e0f043c751fd59912ed36611adfcc7a7ce4ae15c.tar.bz2 Ishtar-e0f043c751fd59912ed36611adfcc7a7ce4ae15c.zip | |
Site labels: fix translation of customization
Diffstat (limited to 'ishtar_common/models.py')
| -rw-r--r-- | ishtar_common/models.py | 25 | 
1 files changed, 21 insertions, 4 deletions
| diff --git a/ishtar_common/models.py b/ishtar_common/models.py index e33fb73e4..7798c722d 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1478,6 +1478,19 @@ FIND_INDEX_SOURCE = ((u"O", _(u"Operations")),                       (u"CR", _(u"Context records")))  SITE_LABELS = [('site', _(u"Site")), ('entity', _(u"Archaeological site"))] +TRANSLATED_SITE_LABELS = { +    'site': { +        'search': _(u"Site search"), +        'new': _(u"New site"), +        'modification': _(u"Site modification"), +    }, +    'entity': { +        'search': _(u"Archaeological site search"), +        'new': _(u"New archaeological site"), +        'modification': _(u"Archaeological site modification"), +    }, +} +  class IshtarSiteProfile(models.Model, Cached):      slug_field = 'slug' @@ -1596,11 +1609,15 @@ class IshtarSiteProfile(models.Model, Cached):          return obj      @classmethod -    def get_default_site_label(cls): -        return cls.get_current_profile().get_site_label() +    def get_default_site_label(cls, key=None): +        return cls.get_current_profile().get_site_label(key) -    def get_site_label(self): -        return unicode(dict(SITE_LABELS)[self.archaeological_site_label]) +    def get_site_label(self, key=None): +        if not key: +            return unicode(dict(SITE_LABELS)[self.archaeological_site_label]) +        return unicode( +            TRANSLATED_SITE_LABELS[self.archaeological_site_label][key] +        )      def save(self, *args, **kwargs):          raw = False | 
