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:37:43 -0300
commit4b715fc05a75c375d5afe1860ce748ae2a2e290b (patch)
treec86574e7000aa0238354143c8e9b4f687c9728c3 /django
parent1d0fc61b1cadee584a27dbbe3ef3e21fd3202c85 (diff)
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.
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: