Misc PR review fixes
parent
317ad64ae6
commit
8d1aea5b2e
|
@ -85,7 +85,7 @@ function getFormatStrings(str) {
|
||||||
const formatStrings = new Set();
|
const formatStrings = new Set();
|
||||||
|
|
||||||
let match;
|
let match;
|
||||||
while ( (match = formatStringRe.exec(str)) !== null) {
|
while ( (match = formatStringRe.exec(str) ) !== null) {
|
||||||
const placeholder = match[1]; // Minus the leading '%'
|
const placeholder = match[1]; // Minus the leading '%'
|
||||||
if (placeholder === '%') continue; // Literal % is %%
|
if (placeholder === '%') continue; // Literal % is %%
|
||||||
|
|
||||||
|
@ -96,14 +96,14 @@ function getFormatStrings(str) {
|
||||||
if (placeholderMatch.length < 3) {
|
if (placeholderMatch.length < 3) {
|
||||||
throw new Error("Malformed format specifier");
|
throw new Error("Malformed format specifier");
|
||||||
}
|
}
|
||||||
const placeHolderName = placeholderMatch[1];
|
const placeholderName = placeholderMatch[1];
|
||||||
const placeHolderFormat = placeholderMatch[2];
|
const placeholderFormat = placeholderMatch[2];
|
||||||
|
|
||||||
if (placeHolderFormat !== 's') {
|
if (placeholderFormat !== 's') {
|
||||||
throw new Error(`'${placeHolderFormat}' used as format character: you probably didn't mean this`);
|
throw new Error(`'${placeholderFormat}' used as format character: you probably meant 's'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
formatStrings.add(placeHolderName);
|
formatStrings.add(placeholderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return formatStrings;
|
return formatStrings;
|
||||||
|
@ -142,7 +142,6 @@ function getTranslationsJs(file) {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log();
|
console.log();
|
||||||
console.error(`ERROR: ${file}:${node.loc.start.line} ${tKey}`);
|
console.error(`ERROR: ${file}:${node.loc.start.line} ${tKey}`);
|
||||||
console.error(e);
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue