Mercurial > sat_legacy_website
comparison sat_website/social_contract.py @ 9:bdd6ccffe149
language code split
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 02 Aug 2012 01:57:47 +0200 |
parents | c70038fb98dc |
children |
comparison
equal
deleted
inserted
replaced
8:c70038fb98dc | 9:bdd6ccffe149 |
---|---|
24 from django.utils.translation import get_language | 24 from django.utils.translation import get_language |
25 CONTRAT_SOCIAL = "CONTRAT_SOCIAL" | 25 CONTRAT_SOCIAL = "CONTRAT_SOCIAL" |
26 | 26 |
27 def get_social_contract(): | 27 def get_social_contract(): |
28 """Return the localised social contract version""" | 28 """Return the localised social contract version""" |
29 language_code = get_language() | 29 language_code = get_language().split("-")[0] |
30 filename = CONTRAT_SOCIAL if language_code == "fr" else "CONTRAT_SOCIAL_%s" % (language_code,) | 30 filename = CONTRAT_SOCIAL if language_code == "fr" else "CONTRAT_SOCIAL_%s" % (language_code,) |
31 path = join(dirname(__file__), filename) | 31 path = join(dirname(__file__), filename) |
32 if not exists(path): | 32 if not exists(path): |
33 path = join(dirname(__file__), CONTRAT_SOCIAL) #we default to original version | 33 path = join(dirname(__file__), CONTRAT_SOCIAL) #we default to original version |
34 | 34 |