[FIX] Better format detection when importing lang files

lp bug: https://launchpad.net/bugs/300624 fixed

bzr revid: christophe@tinyerp.com-20081121133137-kku630y4tao1axwm
This commit is contained in:
Christophe Simonis
2008-11-21 14:31:37 +01:00
parent c0a3eea899
commit ff02f6456f
@@ -31,12 +31,13 @@ view_form="""<?xml version="1.0"?>
<image name="gtk-dialog-info" colspan="2"/>
<group colspan="2" col="4">
<separator string="Import new language" colspan="4"/>
<field name="name"/>
<field name="name" width="200"/>
<field name="code"/>
<field name="data" colspan="3"/>
<field name="data" colspan="4"/>
<label string="You have to import a .CSV file wich is encoded in UTF-8.\n
Please check that the first line of your file is:" colspan="4" align="0.0"/>
Please check that the first line of your file is one of the following:" colspan="4" align="0.0"/>
<label string="type,name,res_id,src,value" colspan="4"/>
<label string="module,type,name,res_id,src,value" colspan="4"/>
<label string="You can also import .po files." colspan="4" align="0.0"/>
</group>
</form>"""
@@ -56,7 +57,7 @@ class wizard_import_lang(wizard.interface):
# now we determine the file format
fileobj.seek(0)
first_line = fileobj.readline().strip()
first_line = fileobj.readline().strip().replace('"', '').replace(' ', '')
fileformat = first_line.endswith("type,name,res_id,src,value") and 'csv' or 'po'
fileobj.seek(0)