Skip to content
This repository was archived by the owner on Aug 17, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Contentstack
Copyright (c) 2024 Contentstack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
3 changes: 2 additions & 1 deletion src/messages/index.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -122,7 +122,8 @@ const $t = (msg: string, args: Record<string, string>): string => {
if (!msg) return "";

for (const key of Object.keys(args)) {
msg = msg.replace(new RegExp(`{${key}}`, 'g'), args[key]);
const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
msg = msg.replace(new RegExp(`{${escapedKey}}`, "g"), args[key]);
}

return msg;
Expand Down