Browse Source

Merge pull request #3455 from H0llyW00dzZ/trimtopic

Yifei Zhang 1 year ago
parent
commit
28c12606a4
1 changed files with 4 additions and 1 deletions
  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) {