diff --git a/LICENSE b/LICENSE index a48530c..f99e9ee 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/src/messages/index.ts b/src/messages/index.ts index 6e0f533..98d47d9 100644 --- a/src/messages/index.ts +++ b/src/messages/index.ts @@ -122,7 +122,8 @@ const $t = (msg: string, args: Record): 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;