Ticket #7084: trans_real.py

File trans_real.py, 2.0 KB (added by Mihai Damian, 17 years ago)

patch for django.utils.translation.templatize

Line 
1Index: trans_real.py
2===================================================================
3--- trans_real.py (revision 7455)
4+++ trans_real.py (working copy)
5@@ -459,13 +459,19 @@
6 pluralmatch = plural_re.match(t.contents)
7 if endbmatch:
8 if inplural:
9- out.write(' ngettext(%r,%r,count) ' % (''.join(singular), ''.join(plural)))
10+ if os.name == 'nt' or os.name == 'os2':
11+ out.write(' ngettext(%r,%r,count) ' % (''.join(singular).replace("\r\n","\n"), ''.join(plural).replace("\r\n","\n")))
12+ else:
13+ out.write(' ngettext(%r,%r,count) ' % (''.join(singular), ''.join(plural)))
14 for part in singular:
15 out.write(blankout(part, 'S'))
16 for part in plural:
17 out.write(blankout(part, 'P'))
18 else:
19- out.write(' gettext(%r) ' % ''.join(singular))
20+ if os.name == 'nt' or os.name == 'os2':
21+ out.write(' gettext(%r) ' % ''.join(singular).replace("\r\n","\n"))
22+ else:
23+ out.write(' gettext(%r) ' % ''.join(singular))
24 for part in singular:
25 out.write(blankout(part, 'S'))
26 intrans = False
27@@ -495,7 +501,10 @@
28 g = imatch.group(1)
29 if g[0] == '"': g = g.strip('"')
30 elif g[0] == "'": g = g.strip("'")
31- out.write(' gettext(%r) ' % g)
32+ if os.name == 'nt' or os.name == 'os2':
33+ out.write(' gettext(%r) ' % g.replace("\r\n","\n"))
34+ else:
35+ out.write(' gettext(%r) ' % g)
36 elif bmatch:
37 for fmatch in constant_re.findall(t.contents):
38 out.write(' _(%s) ' % fmatch)
Back to Top