diff --git a/ts/util/i18n/localizedString.ts b/ts/util/i18n/localizedString.ts index 759ded8fb..f6f1508f9 100644 --- a/ts/util/i18n/localizedString.ts +++ b/ts/util/i18n/localizedString.ts @@ -89,13 +89,13 @@ export type StringArgsRecord = Record, string | // Above is testing stuff function getPluralKey(string: PluralString): R { - const match = /{(\w+), plural, one \[.+\] other \[.+\]}/g.exec(string); + const match = /{(\w+), plural, (zero|one|two|few|many|other) \[.+\]}/g.exec(string); return match?.[1] as R; } // TODO This regex is only going to work for the one/other case what about other langs where we can have one/two/other for example const isPluralForm = (localizedString: string): localizedString is PluralString => - /{\w+, plural, one \[.+\] other \[.+\]}/g.test(localizedString); + /{(\w+), plural, (zero|one|two|few|many|other) \[.+\]}/g.test(localizedString); /** * Checks if a string contains a dynamic variable.