Show welcome message in dashboard in different languages (#1498)

Added the necessary code to show the welcome message in different languages, also the json languages files in english and spanish were modified in order to complement this feature
This commit is contained in:
Jacobo Covarrubias
2023-02-11 23:31:53 -04:00
committed by GitHub
parent 3af7697e93
commit b28df89c0e
3 changed files with 19 additions and 9 deletions
+7 -1
View File
@@ -4,5 +4,11 @@
"evaluate": "Evaluate",
"label": "Label",
"dashboard": "Dashboard",
"go": "Go"
"go": "Go",
"welcome_message": {
"label": "Welcome, {{username}}!",
"contributor": "Contributor",
"description": "Open Assistant is an open-source AI assistant that uses and trains advanced language models to understand and respond to humans.",
"instruction": "Complete tasks to help train the model and earn points."
}
}
+7 -1
View File
@@ -4,5 +4,11 @@
"evaluate": "Evaluar",
"go": "Ir",
"grab_a_task": "¡Toma una tarea!",
"label": "Etiquetar"
"label": "Etiquetar",
"welcome_message": {
"label": "Bienvenido, {{username}}!",
"contributor": "Contribuidor",
"description": "Open Assistant es un asistente de Inteligencia Artificial de código abierto que utiliza y entrena modelos de lenguaje avanzados para entender y responder a los humanos.",
"instruction": "Completa tareas para ayudar a entrenar el modelo y ganar puntos."
}
}
@@ -1,5 +1,6 @@
import { Box, Divider, Text, useColorMode } from "@chakra-ui/react";
import { useSession } from "next-auth/react";
import { useTranslation } from "next-i18next";
export function WelcomeCard() {
const { colorMode } = useColorMode();
@@ -7,6 +8,7 @@ export function WelcomeCard() {
const titleColor = colorMode === "light" ? "blue.500" : "blue.300";
const { data: session } = useSession();
const { t } = useTranslation("dashboard");
if (!session) {
return <></>;
@@ -24,17 +26,13 @@ export function WelcomeCard() {
<Box bg={backgroundColor} borderRadius="xl" p="6" pt="4" pr="12">
<Box pb="2">
<Text as="h1" fontWeight="extrabold" fontSize="3xl" color={titleColor}>
Welcome, {session.user.name || "Contributor"}!
{t("welcome_message.label", { username: session.user.name || t("welcome_message.contributor") })}
</Text>
</Box>
<Box>
<Text>
Open Assistant is an open-source AI assistant that uses and trains advanced language models to
understand and respond to humans.
</Text>
<Text>{t("welcome_message.description")}</Text>
<Divider my="4" />
<Text>Complete tasks to help train the model and earn points.</Text>
<Text>{t("welcome_message.instruction")}</Text>
</Box>
</Box>
</Box>