Skip to content

Dynamic message keys #1607

Dec 13, 2024 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

Try this

type Theme = "dark" | "light" | "system";
{t('general.theme.${theme as Theme}')}

en.json =
{ "theme": { "title": "Theme", "dark": "Dark", "light": "Light", "system": "System" }, }
it worked with me

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

@henrikbossart
Comment options

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