Skip to content

How can I define context/gender for translation? #977

Answered by Cochonours
Cochonours asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for your quick answer! I actually was thinking about doing that before checking this thread back, and the solution you linked to works, but only partially: the problem is that I would need to exhaustively define a translation for each possible context value.

The perfect "working workaround" is do add a fallback, so in my case:

{ t("go_to_country_" + country_code.toLowerCase(), { name: country }, { fallback: 'go_to_country' }) }

This works like a charm!

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

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

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