akameco/babel-plugin-react-intl-auto

[feature] Dynamic ids

serhiipalash opened this issue · 2 comments

  • version: 1.1.1
  • node version: 10.13.0
  • npm version: 6.10.2

Hi @akameco ! Thank you for such a great plugin! We are using it for a few years now and it works great.

I want to ask you is it possible to use constant as message id?

import { defineMessages } from 'react-intl'

const CategoryIds = {
  STROLLER: 'STROLLER',
  BABY_CARRIER: 'BABY_CARRIER',
}

export default defineMessages({
  [CategoryIds.STROLLER]: 'Strollers',
  [CategoryIds.BABY_CARRIER]: 'Carriers',
})

When I try to do like this it throws an error requires Object key or string literal.

@serhiipalash Currently not supported. When is it convenient to use it?

Please open again if there is a follow-up report.