Here's a regex for replacing formatMessage()
in react-intl with t()
in react-i18next in the codebase. The solution here is VSCode compatible.
- Find:
formatMessage\(messages.(\w+)\)
- Replace:
t('$1')
- Find:
formatMessage\(messages.([\w.]+)(,)(.+\))
- assuming that the keys are made up of alphanumericals and dots.
formatMessage\(messages.(\S+)(,)(.+\))
- a more wildcard match that allow any non empty space character in the keys.