diff --git a/src/utils/translation.tsx b/src/utils/translation.tsx index 777584823..a7973671f 100644 --- a/src/utils/translation.tsx +++ b/src/utils/translation.tsx @@ -105,7 +105,8 @@ export function t(key: string, variables?: Record): string { const translation = _t(key, loadedLocale); if (typeof translation !== "string") { - if (!variables || !variables.count) throw new Error(`translation key ${key} is an object (requires plurality?)`); + 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" : @@ -113,8 +114,10 @@ export function t(key: string, variables?: Record): string { if (translation[pluralTag]) { return format(translation[pluralTag]!, variables); - } else { + } 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`); } } }