chore: remove unnecessary if

This commit is contained in:
Lewis Crichton 2024-06-24 19:00:26 +01:00
parent e55c6f99e2
commit faea1c8224
No known key found for this signature in database

View file

@ -108,7 +108,6 @@ export function t(key: string, variables?: Record<string, any>): string {
if (!variables || !variables.count) if (!variables || !variables.count)
throw new Error(`translation key ${key} is an object (is it a plural?)`); throw new Error(`translation key ${key} is an object (is it a plural?)`);
if (variables.count) {
const pluralTag: Intl.LDMLPluralRule = variables.count === 0 ? "zero" : const pluralTag: Intl.LDMLPluralRule = variables.count === 0 ? "zero" :
new Intl.PluralRules(bestLocale).select(variables.count); new Intl.PluralRules(bestLocale).select(variables.count);
@ -120,7 +119,6 @@ export function t(key: string, variables?: Record<string, any>): string {
throw new Error(`translation key ${key} is an object and doesn't seem to be plural`); throw new Error(`translation key ${key} is an object and doesn't seem to be plural`);
} }
} }
}
if (!variables) return translation as string; if (!variables) return translation as string;