Skip to content

Commit 23e5bfb

Browse files
authored
Merge pull request #177 from contentstack/stagingToDev
Staging to development
2 parents 03647c3 + 1f85a85 commit 23e5bfb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Contentstack
3+
Copyright (c) 2024 Contentstack
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/messages/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ const $t = (msg: string, args: Record<string, string>): string => {
122122
if (!msg) return "";
123123

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

128129
return msg;

0 commit comments

Comments
 (0)