summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorRamiro Morales <ramiro@rmorales.net>2013-10-01 20:23:36 -0300
committerRamiro Morales <ramiro@rmorales.net>2013-10-01 20:42:13 -0300
commitd16753eecd3c97c781382fbb4c119f6bae314487 (patch)
tree894a7441889de25faa1c1a617947e2c89d21706a /django
parent9972a101e60d1c4bf1e0b6f3c7946c8716022711 (diff)
[1.6.x] Fixed #21209 -- .po file path comments on Windows.
Literals from source files with Django template language syntax don't have a '.py' suffix anymore. Also, the '.\' prefix is preserved to respect GNU gettext behavior on that platform. Refs #16903. 4b715fc05a from master.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/commands/makemessages.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index 695cad419b..7ad1a8f3aa 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -135,8 +135,14 @@ class TranslatableFile(object):
command.stdout.write(errors)
if msgs:
if is_templatized:
- old = '#: ' + work_file[2:]
- new = '#: ' + orig_file[2:]
+ # Remove '.py' suffix
+ if os.name =='nt':
+ # Preserve '.\' prefix on Windows to respect gettext behavior
+ old = '#: ' + work_file
+ new = '#: ' + orig_file
+ else:
+ old = '#: ' + work_file[2:]
+ new = '#: ' + orig_file[2:]
msgs = msgs.replace(old, new)
write_pot_file(potfile, msgs)
if is_templatized: