Imported Tags Ignored by txjs-cli

I’ve a use case where I’m wanting to store tags in a constant and import / use that in different components, but its not being recognised by txjs-cli.

When I run txjs-cli push the tags are not present in the output (using the verbose argument) and they don’t appear in Transifex. But, if I define the const within the component file the tags are registered.

This does not work

constants.ts

export const MY_TAGS = 'tag1,tag2'

component.tsx

import { T } from '@transifex/react'
import { MY_TAGS } from './constants.ts'
// ...
<T _str="EXAMPLE" _tags={MY_TAGS} />

This does work

component.tsx

import { T } from '@transifex/react'

const MY_TAGS = 'tag1,tag2'

// ...
<T _str="EXAMPLE" _tags={MY_TAGS} />

Hello dear Aaron ,

Thank you for contacting us.

So unfortunately the parser for JSX is not recognizing imports as variables (there is no dynamic evaluation of the imported const). No values can be retrieved from the parsed tree of objects. So at the moment we do not support this functionality.

Kind regards
Christos

1 Like