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 d687cfc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions web/src/components/layout/Icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
*/

import React from 'react';
import { sprintf } from "sprintf-js";

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.
Expand Down Expand Up @@ -151,12 +148,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 d687cfc

Please sign in to comment.