Skip to content

Translate specific parts of app to different locales (React) #731

Answered by ivanhofer
siliconeidolon asked this question in Q&A
Discussion options

You must be logged in to vote

Your solutoin with the contexts is exactly what I was thinking of.
The context approach is really flexible and you can nest them however you like. If you want certain components to be rendered in the original language then you just need to wrap them in anothr context:

export const Button = () => {
	return <>
		<TypeSafeI18n locale={rootLocale}>
			<button />
		</TypeSafeI18n>
	</>
}

Replies: 1 comment 1 reply

Comment options

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

Answer selected by siliconeidolon
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