Odoo Help


[v8] how can I combine English & Chinese translation with a python script?

on 10/7/14, 5:39 AM 1,229 views

I want to make a custom translation. Actually I want to show the (English source) of column E of the translations csv plus the translated term (column F) together. In my case it is a combination of English and Chinese so practically I want to see "Sales 销售“ for the 'Sales' Module for example

I have a python script that should do that (combining column E and column F of the Chinese language .csv) that looks like this

import csv
import sys

filename = sys.argv[1]

with open(filename, 'rb') as f:
    rows = list(csv.reader(f))
    for row in rows:
        if row[4] != row[5]:
            row[5] = ' '.join((row[4], row[5]))
            #print row[5]

with open('chinese_english_combined.csv', 'wb') as f:
    writer = csv.writer(f)

this worked with an older v7 but now trying to combine languages in v8 I get an error

Traceback (most recent call last):
  File "combineLanguages.py", line 9, in <module>
    if row[4] != row[5]:
IndexError: list index out of range


EDIT: I did not write the script myself and I don't know python, that's why I'm asking here



Ludo - 21South

--Ludo - 21South--
| 2 2 5
Zwijndrecht, Netherlands
--Ludo - 21South--


Ludo - 21South
On 10/7/14, 9:06 AM

"List index out of range" means that either column 5 or 6 (the counting starts at 0 for the first column) is not filled in correctly, or might even be missing. Make sure that the csv file you are feeding your script is exactly equal to the one you use in verison 7. That means that it should have the exact same columns, in the exact same order and has at least one row.


If you can confirm that is the case, make sure the 5th and 6th columns at least contain some value.

I though it must be something similar to that. It's a little confusing that python uses the term 'row' when it actually means 'column'. Nevertheless, the file structure is the same and both (column 4 & 5) contain data. Can it be I need to remove the 'header'. Will check that out and report back. By the way: the script doesn't work with the 'old' v7 file neither anymore

on 10/7/14, 10:18 PM

"By the way: the script doesn't work with the 'old' v7 file neither anymore". Check the encoding of your .csv file, it shouldn't unicode as the parser doesn't support it.

Ben Bernard
on 10/7/14, 10:33 PM

using "Chinese Simplified" encoding helped with the error message, thanks. Now I see that something is not working with the commas (as if there where too many of them in the translated terms) in the csv file. I have in total 6 columns (the last being the translated term) but when I open the combined translation that is being made by my script now, so of the terms have many more columns. By default my openoffice gives me the option using "," & ";" for separating things (and when I choose anything else the preview just shows one single column). I guess I have to fix these terms handish or is there any suggestion regarding this from you end?

on 10/23/14, 4:55 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/7/14, 5:39 AM
Seen: 1229 times
Last updated: 3/16/15, 8:10 AM