Skip to content

Commit

Permalink
Fix Trim Topic in Indonesia Language
Browse files Browse the repository at this point in the history
- [+] 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
  • Loading branch information
H0llyW00dzZ committed Dec 5, 2023
1 parent cf50299 commit 54df355
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 54df355

Please sign in to comment.