From 604655c02d9cd5a7bdc80019e0c7a8ea93ffa962 Mon Sep 17 00:00:00 2001 From: garronej Date: Wed, 10 Nov 2021 19:48:18 +0100 Subject: [PATCH] Bring back Safari compat --- src/lib/i18n/useKcMessage.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/i18n/useKcMessage.tsx b/src/lib/i18n/useKcMessage.tsx index 7170ea30..f453d4cf 100644 --- a/src/lib/i18n/useKcMessage.tsx +++ b/src/lib/i18n/useKcMessage.tsx @@ -27,8 +27,9 @@ function resolveMsg(props: str = (() => { const startIndex = str - .match(/(?<={)[0-9]+(?=})/g) - ?.map(g => parseInt(g)) + .match(/{[0-9]+}/g) + ?.map(g => g.match(/{([0-9]+)}/)![1]) + .map(indexStr => parseInt(indexStr)) .sort((a, b) => a - b)[0]; if (startIndex === undefined) {