From c731e4282b8e518672d9fc5c86de60d9cb718814 Mon Sep 17 00:00:00 2001 From: mabashian Date: Wed, 26 Aug 2020 13:18:07 -0400 Subject: [PATCH] Use low level i18n._ instead of i18n.plural for plurals on the schedule form. This fixes a bug where the page would crash on static builds when a frequency was selected. --- .../shared/FrequencyDetailSubform.jsx | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/awx/ui_next/src/components/Schedule/shared/FrequencyDetailSubform.jsx b/awx/ui_next/src/components/Schedule/shared/FrequencyDetailSubform.jsx index 8e6ea219c0..a23a146059 100644 --- a/awx/ui_next/src/components/Schedule/shared/FrequencyDetailSubform.jsx +++ b/awx/ui_next/src/components/Schedule/shared/FrequencyDetailSubform.jsx @@ -181,42 +181,32 @@ const FrequencyDetailSubform = ({ i18n }) => { }; const getRunEveryLabel = () => { + const intervalValue = interval.value; + switch (frequency.value) { case 'minute': - return i18n.plural({ - value: interval.value, - one: 'minute', - other: 'minutes', + return i18n._('{intervalValue, plural, one {minute} other {minutes}}', { + intervalValue, }); case 'hour': - return i18n.plural({ - value: interval.value, - one: 'hour', - other: 'hours', + return i18n._('{intervalValue, plural, one {hour} other {hours}}', { + intervalValue, }); case 'day': - return i18n.plural({ - value: interval.value, - one: 'day', - other: 'days', + return i18n._('{intervalValue, plural, one {day} other {days}}', { + intervalValue, }); case 'week': - return i18n.plural({ - value: interval.value, - one: 'week', - other: 'weeks', + return i18n._('{intervalValue, plural, one {week} other {weeks}}', { + intervalValue, }); case 'month': - return i18n.plural({ - value: interval.value, - one: 'month', - other: 'months', + return i18n._('{intervalValue, plural, one {month} other {months}}', { + intervalValue, }); case 'year': - return i18n.plural({ - value: interval.value, - one: 'year', - other: 'years', + return i18n._('{intervalValue, plural, one {year} other {years}}', { + intervalValue, }); default: throw new Error(i18n._(t`Frequency did not match an expected value`));