Skip to content

Commit

Permalink
clean up console spam from react intl
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-heppner-ibigroup committed Oct 2, 2024
1 parent 3925783 commit 8fee63d
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions .storybook/react-intl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,25 @@ const messages = {};

// Populate messages if not running snapshots.
// (Message printouts would be unnecessary replicated in snapshots without that check.)
packages.forEach((pkg) => {
locales.forEach((locale) => {
// Chinese-simplified is assigned a special file name by Weblate.
const localeFile = locale === "zh" ? "zh_Hans" : locale;
try {
messages[locale] = {
...messages[locale],
...flatten(require(`../packages/${pkg}/i18n/${localeFile}.yml`).default)
};
} catch (e) {
// There is no yml files for the "unknown" locale,
// so it should fail, and we won't display an error message in that case.
if (locale !== "unknown") console.error(e);
}
if (typeof window !== "undefined") {

packages.forEach((pkg) => {
locales.forEach((locale) => {
// Chinese-simplified is assigned a special file name by Weblate.
const localeFile = locale === "zh" ? "zh_Hans" : locale;
try {
messages[locale] = {
...messages[locale],
...flatten(require(`../packages/${pkg}/i18n/${localeFile}.yml`).default)
};
} catch (e) {
// There is no yml files for the "unknown" locale,
// so it should fail, and we won't display an error message in that case.
if (locale !== "unknown") console.error(e);
}
});
});
});
}

// TODO: place any applicable (date, time, etc) format parameters here.
const formats = {};
Expand Down

0 comments on commit 8fee63d

Please sign in to comment.