From f0252f1cfc54fe66be608d72d7cec2d923530ae5 Mon Sep 17 00:00:00 2001 From: Dmitry Upolovnikov Date: Mon, 21 May 2012 12:41:02 +0300 Subject: [PATCH] Added msgctxt for entrie's md5. --- .gitignore | 4 +++- rosetta/views.py | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c093944..7c640e4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ dist .svnignore .svnexternals build -rosetta/locale/xx/LC_MESSAGES/*.mo \ No newline at end of file +rosetta/locale/xx/LC_MESSAGES/*.mo +/.settings +/.project diff --git a/rosetta/views.py b/rosetta/views.py index a476e34..b2be811 100644 --- a/rosetta/views.py +++ b/rosetta/views.py @@ -56,7 +56,11 @@ def home(request): if rosetta_i18n_write: rosetta_i18n_pofile = pofile(rosetta_i18n_fn, wrapwidth=rosetta_settings.POFILE_WRAP_WIDTH) for entry in rosetta_i18n_pofile: - entry.md5hash = hashlib.md5(entry.msgid.encode("utf8") + entry.msgstr.encode("utf8")).hexdigest() + entry.md5hash = hashlib.md5( + entry.msgid.encode("utf8") + + entry.msgstr.encode("utf8") + + (entry.msgctxt and entry.msgctxt.encode("utf8") or "") + ).hexdigest() else: rosetta_i18n_pofile = request.session.get('rosetta_i18n_pofile') @@ -344,7 +348,11 @@ def lang_sel(request, langid, idx): request.session['rosetta_i18n_fn'] = file_ po = pofile(file_) for entry in po: - entry.md5hash = hashlib.md5(entry.msgid.encode("utf8") + entry.msgstr.encode("utf8")).hexdigest() + entry.md5hash = hashlib.md5( + entry.msgid.encode("utf8") + + entry.msgstr.encode("utf8") + + (entry.msgctxt and entry.msgctxt.encode("utf8") or "") + ).hexdigest() request.session['rosetta_i18n_pofile'] = po try: