Opened 4 years ago

Closed 4 years ago

Last modified 2 years ago

#16493 closed New feature (needsinfo)

Windows: makemessages generate django.po should use forward slashes too

Reported by: raidsan@… Owned by: nobody
Component: Core (Management commands) Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

develope under windows, run "python manage.py makemessages ...", will write file path use "\" in django.po,
the files copy to product linux server, should not be valid, because unix/linux use "/" as path seperater.
the solution should be use the same "/" in path string even under windows.
so, I add a function "normpath" to ensure use "/" under windows:

def normpath(filepath):
    p = os.path.normpath(filepath)
    if os.name=='nt':
        p = p.replace("\\", "/")
    return p

Attachments (1)

makemessages.py (16.4 KB) - added by raidsan@… 4 years ago.

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by raidsan@…

comment:1 Changed 4 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

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?

comment:2 Changed 2 years ago by ramiro

  • Summary changed from winodws: makemessages generate django.po should use forward slashes too to Windows: makemessages generate django.po should use forward slashes too

comment:3 Changed 2 years ago 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.

comment:4 Changed 2 years ago by aaugustin

makemessages gained a '--no-location' option since this ticket was initially filed. That probably resolves your problem.

Note: See TracTickets for help on using tickets.
Back to Top