From 54df355014c104b324fc76f38c271a2a15fd5470 Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Tue, 5 Dec 2023 07:26:11 +0700 Subject: [PATCH] Fix Trim Topic in Indonesia Language - [+] fix(utils.ts): fix trimTopic function to remove double quotes from the start and end of the string, and remove specified punctuation from the end of the string --- app/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/utils.ts b/app/utils.ts index acc140ac30b..ac7e80e7afd 100644 --- a/app/utils.ts +++ b/app/utils.ts @@ -3,7 +3,10 @@ import { showToast } from "./components/ui-lib"; import Locale from "./locales"; export function trimTopic(topic: string) { - return topic.replace(/[,。!?”“"、,.!?]*$/, ""); + // Fix an issue where double quotes still show in the Indonesian language + // This will remove the specified punctuation from the end of the string + // and also trim quotes from both the start and end if they exist. + return topic.replace(/^["“”]+|["“”]+$/g, "").replace(/[,。!?”“"、,.!?]*$/, ""); } export async function copyToClipboard(text: string) {