Improve error reporting when parsing CSV translation file

Fixes #46682.

Also fix unit test suite to separate generic FileAccess CSV testing
from using CSV as translation. And add more CSV translation tests.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
This commit is contained in:
andybarcia
2021-03-19 19:50:53 +01:00
committed by Rémi Verschelde
parent 7188ed5f91
commit 553f4f8dce
6 changed files with 54 additions and 23 deletions

8
tests/data/testdata.csv Normal file
View File

@ -0,0 +1,8 @@
Header 1,Header 2,Header 3,Header 4
GOOD_MORNING,"Good Morning","Guten Morgen","Bonjour"
GOOD_EVENING,"Good Evening","",""""""
Without quotes,"With, comma","With ""inner"" quotes","With ""inner"", quotes"","" and comma","With ""inner
split"" quotes and
line breaks","With \nnewline chars"
Some other~delimiter~should still work, shouldn't it?
What about tab separated lines, good?
Can't render this file because it has a wrong number of fields in line 4.

View File

@ -1,8 +1,3 @@
keys,en,de
GOOD_MORNING,"Good Morning","Guten Morgen"
GOOD_EVENING,"Good Evening",""
Without quotes,"With, comma","With ""inner"" quotes","With ""inner"", quotes"","" and comma","With ""inner
split"" quotes and
line breaks","With \nnewline chars"
Some other~delimiter~should still work, shouldn't it?
What about tab separated lines, good?
keys,en,de,ja,fa
GOOD_MORNING,"Good Morning","Guten Morgen","おはよう","صبح بخیر"
GOOD_EVENING,"Good Evening","","こんばんは","عصر بخیر"

Can't render this file because it has a wrong number of fields in line 4.