mirror of
https://github.com/Hopiu/django-rosetta.git
synced 2026-05-04 19:54:42 +00:00
Added msgctxt for entrie's md5.
This commit is contained in:
parent
4067e069bd
commit
f0252f1cfc
2 changed files with 13 additions and 3 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -5,4 +5,6 @@ dist
|
|||
.svnignore
|
||||
.svnexternals
|
||||
build
|
||||
rosetta/locale/xx/LC_MESSAGES/*.mo
|
||||
rosetta/locale/xx/LC_MESSAGES/*.mo
|
||||
/.settings
|
||||
/.project
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue