incr: fetch translateables from schema.json

- use legit csv
This commit is contained in:
18alantom
2022-05-23 16:18:23 +05:30
parent 56e5a7fc74
commit 03ee043696
5 changed files with 141 additions and 93 deletions
+2 -5
View File
@@ -49,11 +49,8 @@ function splitCsvBlock(text: string, splitter: string = '\r\n'): string[] {
return lines;
}
function splitCsvLine(line: string): string[] {
if (line.at(-1) !== ',') {
// if conforming to spec, it should not end with ','
line += ',';
}
export function splitCsvLine(line: string): string[] {
line += ',';
const items = [];
let item = '';
-31
View File
@@ -57,34 +57,3 @@ export function getWhitespaceSanitized(str: string) {
export function getIndexList(str: string) {
return [...str.matchAll(/\${([^}]+)}/g)].map(([_, i]) => parseInt(i));
}
export function wrap(str: string) {
return '`' + str + '`';
}
export function splitCsvLine(line: string) {
let t = true;
const chars = [...line];
const indices = chars
.map((c, i) => {
if (c === '`') {
t = !t;
}
if (c === ',' && t) {
return i;
}
return -1;
})
.filter((i) => i !== -1);
let s = 0;
const splits = indices.map((i) => {
const split = line.slice(s, i);
s = i + 1;
return split.trim();
});
splits.push(line.slice(s).trim());
return splits.filter((s) => s !== ',' && s !== '');
}