diff --git a/src/utils/translation.tsx b/src/utils/translation.tsx index a7973671f..3202b9982 100644 --- a/src/utils/translation.tsx +++ b/src/utils/translation.tsx @@ -108,17 +108,15 @@ export function t(key: string, variables?: Record): string { if (!variables || !variables.count) throw new Error(`translation key ${key} is an object (is it a plural?)`); - if (variables.count) { - const pluralTag: Intl.LDMLPluralRule = variables.count === 0 ? "zero" : - new Intl.PluralRules(bestLocale).select(variables.count); + const pluralTag: Intl.LDMLPluralRule = variables.count === 0 ? "zero" : + new Intl.PluralRules(bestLocale).select(variables.count); - if (translation[pluralTag]) { - return format(translation[pluralTag]!, variables); - } else if (translation.other) { - return format(translation.other, variables); - } else { - throw new Error(`translation key ${key} is an object and doesn't seem to be plural`); - } + if (translation[pluralTag]) { + return format(translation[pluralTag]!, variables); + } else if (translation.other) { + return format(translation.other, variables); + } else { + throw new Error(`translation key ${key} is an object and doesn't seem to be plural`); } }