--
Ticket URL: <https://code.djangoproject.com/ticket/16493>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_docs: => 0
Comment:
The only paths in .po files are comments, so I don't understand why you
say that the resulting file "should not be valid".
Do you really get an error? If yes, can you provide the traceback?
--
Ticket URL: <https://code.djangoproject.com/ticket/16493#comment:1>
--
Ticket URL: <https://code.djangoproject.com/ticket/16493#comment:2>
Comment (by mithuntnt@…):
The problem i had here was merging between developers using windows and
linux. The windows version change everything to backslash and linux
version changes it to slash. The end result is we need end merging all
comments.
--
Ticket URL: <https://code.djangoproject.com/ticket/16493#comment:3>
Comment (by aaugustin):
makemessages gained a '--no-location' option since this ticket was
initially filed. That probably resolves your problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/16493#comment:4>
Comment (by John Vandenberg):
This makes it difficult for Unix and Windows developers to be working on
the same project. The .po file will switch back and forth each time. The
file in the comment is useful information, so using `--no-location` is not
a great solution.
--
Ticket URL: <https://code.djangoproject.com/ticket/16493#comment:5>
Comment (by Vipul Chaudhary):
I agree with John. Removing information from the document is not the
solution to a problem which is easily fixable within the makemessages
command.
--
Ticket URL: <https://code.djangoproject.com/ticket/16493#comment:6>
Comment (by John Vandenberg):
The following makemessages.py works around this problem:
{{{#!python
import os
import sys
from django.core.management.commands.makemessages import Command as
MakeMessagesCommand
class Command(MakeMessagesCommand):
def find_files(self, root):
all_files = super().find_files(root)
if os.sep != "\\":
return all_files
for file_entry in all_files:
if file_entry.dirpath == ".":
file_entry.dirpath = ""
elif file_entry.dirpath.startswith(".\\"):
file_entry.dirpath = file_entry.dirpath[2:].replace("\\",
"/")
return all_files
def build_potfiles(self):
pot_files = super().build_potfiles()
if os.sep != "\\":
return pot_files
for filename in pot_files:
lines = open(filename, "r", encoding="utf-8").readlines()
fixed_lines = []
for line in lines:
if line.startswith("#: "):
line = line.replace("\\", "/")
fixed_lines.append(line)
with open(filename, "w", encoding="utf-8") as f:
f.writelines(fixed_lines)
return pot_files
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16493#comment:7>