Skip to content

How do we use a constant's value as a lingui id? #1112

Discussion options

You must be logged in to vote

We ended up using it like this:

t`my-text-constant`
const MI_TEXT_CONSTANT = "my-text-constant";

The id generation next to the actual constant, with comments making sure that devs always keep the macro and the actual string the same.

This way Lingui generates the id, and the constant is set with the literal text and not with the translation.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@semoal
Comment options

Comment options

You must be logged in to vote
2 replies
@thekip
Comment options

@santiagopuentep
Comment options

Answer selected by santiagopuentep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants