This video is available to students only
Translations
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).
1
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.
1
// App.tsx
2
import { Language } from "./types";
3
4
// ...
5
6
const [language, setLanguage] = useState<Language>("en");
Next, add a language selector at the top of the return statement.
This page is a preview of Building Advanced Admin Reporting in React