Merge lp:~openerp-dev/openobject-server/6.1-opw-581687-cbi into lp:openobject-server/6.1

Proposed by Chris Biersbach (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-server/6.1-opw-581687-cbi
Merge into: lp:openobject-server/6.1
Diff against target: 20 lines (+2/-2)
1 file modified
openerp/tools/translate.py (+2/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/6.1-opw-581687-cbi
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+140832@code.launchpad.net

Description of the change

The issue that was encountered: When syncing the translations on windows, duplicate entries were created for the terms of type "code", with the slash replaced by a backslash. (ex.: x/y/z -> x\y\z)

The reason: We use the OS path separator when generating the translations. The preloaded translations always have a slash, if you sync on windows, the separator is a backslash and you will thus get the new translations with the backslash, because it is considered as a different entry from the one with slashes.

The fix: I changed the method that generates the paths for code terms to always use slashes, regardless of the OS.
That way, no more duplicated entries are created.

To post a comment you must log in.

Unmerged revisions

4320. By Chris Biersbach (OpenERP)

[FIX] Syncing the translations on operating systems that do not use / as file separator will now no longer create duplicate translation entries

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/tools/translate.py'
2--- openerp/tools/translate.py 2012-10-08 11:09:46 +0000
3+++ openerp/tools/translate.py 2012-12-20 08:30:33 +0000
4@@ -827,7 +827,7 @@
5 # now, since we did a binary read of a python source file, we
6 # have to expand pythonic escapes like the interpreter does.
7 src = src.decode('string_escape')
8- push_translation(module, terms_type, frelativepath, code_line, encode(src))
9+ push_translation(module, terms_type, '/'.join(frelativepath.split(os.path.sep)), code_line, encode(src))
10 code_line += i.group(1).count('\n')
11 code_offset = i.end() # we have counted newlines up to the match end
12
13@@ -843,7 +843,7 @@
14 src = join_quotes.sub(r'\1', src)
15 code_line += code_string[code_offset:i.start(1)].count('\n')
16 src = src.decode('string_escape')
17- push_translation(module, terms_type, frelativepath, code_line, encode(src))
18+ push_translation(module, terms_type, '/'.join(frelativepath.split(os.path.sep)), code_line, encode(src))
19 code_line += i.group(1).count('\n')
20 code_offset = i.end() # we have counted newlines up to the match end
21