Skip to content

Commit

Permalink
fix(i18n): avoid passing non-string parameters to i18n engine
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Jul 8, 2021
1 parent a7bde37 commit abec736
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/formattingTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function gentitle(titles, type) {
return lasttitle;
}
if (typeof type === 'string') {
return i18n`Untitled ${type} in ${firsttitle}`;
return i18n`Untitled ${type} in ${String(firsttitle)}`;
}
if (firsttitle === undefined) {
return i18n`Untitled schema`;
Expand Down
4 changes: 2 additions & 2 deletions lib/markdownBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,12 @@ function build({
}
if (schema[keyword`minContains`] !== undefined && schema[keyword`contains`]) {
// console.log('minContains!', schema[s.filename], schema[s.pointer]);
constraints.push(paragraph([strong(text(i18n`minimum number of contained items`)), text(': '), text(`${i18n`this array may not contain fewer than ${schema[keyword`minContains`]} items that validate against the schema:`} `),
constraints.push(paragraph([strong(text(i18n`minimum number of contained items`)), text(': '), text(`${i18n`this array may not contain fewer than ${String(schema[keyword`minContains`])} items that validate against the schema:`} `),
link(`${schema[keyword`contains`][s.slug]}.md`, i18n`check type definition`, text(gentitle(schema[keyword`contains`][s.titles], schema[keyword`contains`][keyword`type`])))]));
}
if (schema[keyword`maxContains`] !== undefined && schema[keyword`contains`]) {
// console.log('maxContains!', schema[s.filename], schema[s.pointer]);
constraints.push(paragraph([strong(text(i18n`maximum number of contained items`)), text(': '), text(`${i18n`this array may not contain more than ${schema[keyword`maxContains`]} items that validate against the schema:`} `),
constraints.push(paragraph([strong(text(i18n`maximum number of contained items`)), text(': '), text(`${i18n`this array may not contain more than ${String(schema[keyword`maxContains`])} items that validate against the schema:`} `),
link(`${schema[keyword`contains`][s.slug]}.md`, i18n`check type definition`, text(gentitle(schema[keyword`contains`][s.titles], schema[keyword`contains`][keyword`type`])))]));
}

Expand Down

0 comments on commit abec736

Please sign in to comment.