How to Build a Multilingual React Site with Query Builder
Adding another bit of customization to the query builder -- a Spanish translation
Let's take our configuration to the next level. First, we'll add a Spanish translation to the query builder.
Spanish translation#
Create a file called types.ts
that exports the type Language
, which consists of the two strings "en"
and "es"
(English and Spanish, respectively).
export type Language = "en" | "es";
Add a state variable to the App
component to track the language. Default the value to "en"
to represent English.
const [language, setLanguage] = useState<Language>("en");
Next, add a language selector at the top of the return statement.
This lesson preview is part of the Building Advanced Admin Reporting in React course and can be unlocked immediately with a \newline Pro subscription or a single-time purchase. Already have access to this course? Log in here.
Get unlimited access to Building Advanced Admin Reporting in React, plus 70+ \newline books, guides and courses with the \newline Pro subscription.
