Parcourir la source

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
H0llyW00dzZ il y a 1 an
Parent
commit
54df355014
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4 1
      app/utils.ts

+ 4 - 1
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) {