Skip to content

Commit

Permalink
[web] Do not translate console.error
Browse files Browse the repository at this point in the history
  • Loading branch information
dgdavid committed Nov 2, 2023
1 parent 116c8b4 commit 480e2a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions web/src/components/layout/Icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import React from 'react';
import { sprintf } from "sprintf-js";

Check warning on line 23 in web/src/components/layout/Icon.jsx

View workflow job for this annotation

GitHub Actions / frontend_build (18.x)

'sprintf' is defined but never used

Check warning on line 23 in web/src/components/layout/Icon.jsx

View workflow job for this annotation

GitHub Actions / frontend_build (18.x)

'sprintf' is defined but never used

import { _ } from "~/i18n";

// NOTE: "@icons" is an alias to use a shorter path to real @material-symbols
// icons location. Check the tsconfig.json file to see its value.
import AddAPhoto from "@icons/add_a_photo.svg?component";
Expand Down Expand Up @@ -151,12 +149,12 @@ const icons = {
*/
export default function Icon({ name, className = "", size = 32, ...otherProps }) {
if (!name) {
console.error(sprintf(_("Icon called without name. `%s` given instead. Rendering nothing."), name));
console.error(`Icon called without name. '${name}' given instead. Rendering nothing`);
return null;
}

if (!icons[name]) {
console.error(sprintf(_("Icon %s not found!"), name));
console.error(`Icon '${name}' not found!`);
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/layout/Icon.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe("Icon", () => {
it("outputs to console.error", () => {
plainRender(<Icon name="apsens" />);
expect(console.error).toHaveBeenCalledWith(
expect.stringContaining("apsens not found")
expect.stringContaining("'apsens' not found")
);
});

Expand Down

0 comments on commit 480e2a1

Please sign in to comment.