Mercurial > sat_legacy_website
changeset 8:c70038fb98dc
Social Contract (Contrat Social) localisation
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 02 Aug 2012 01:45:18 +0200 |
parents | 4bdc81db6282 |
children | bdd6ccffe149 |
files | sat_website/social_contract.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_website/social_contract.py Thu Aug 02 01:44:52 2012 +0200 +++ b/sat_website/social_contract.py Thu Aug 02 01:45:18 2012 +0200 @@ -20,11 +20,18 @@ along with Foobar. If not, see <http://www.gnu.org/licenses/>. """ -from os.path import join, dirname +from os.path import join, dirname, exists +from django.utils.translation import get_language +CONTRAT_SOCIAL = "CONTRAT_SOCIAL" -def get_social_contract(language_code="fr"): +def get_social_contract(): """Return the localised social contract version""" - path = join(dirname(__file__), "CONTRAT_SOCIAL") + language_code = get_language() + filename = CONTRAT_SOCIAL if language_code == "fr" else "CONTRAT_SOCIAL_%s" % (language_code,) + path = join(dirname(__file__), filename) + if not exists(path): + path = join(dirname(__file__), CONTRAT_SOCIAL) #we default to original version + with open(path) as f: text = f.read() return text