Skip to content

Commit

Permalink
fix gettext error when planning is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek committed Oct 6, 2023
1 parent d5d7abd commit 340d1c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/core/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ export const gettext = (

let translated = i18n.gettext(text);

const hasReactPlaceholders = Object.values(params).some((val) => typeof val === 'function');
const hasReactPlaceholders = Object.values(params ?? {}).some((val) => typeof val === 'function');

if (hasReactPlaceholders) {
return gettextReact(translated, params);
return gettextReact(translated, params ?? {});
} else {
Object.keys(params ?? {}).forEach((param) => {
translated = translated.replace(new RegExp(`{{\\s*${param}\\s*}}`, 'g'), params[param]);
Expand Down

0 comments on commit 340d1c0

Please sign in to comment.