diff --git a/src/components/HeroHome.astro b/src/components/HeroHome.astro index e30d69f..a14d9f5 100644 --- a/src/components/HeroHome.astro +++ b/src/components/HeroHome.astro @@ -1,6 +1,11 @@ --- import Header from './Header.astro'; import { Icon } from 'astro-icon/components'; +import { useTranslations } from '../utils/i18n'; + +// Set the language for translations +const lang = 'es'; +const t = useTranslations(lang); ---
@@ -22,7 +27,7 @@ import { Icon } from 'astro-icon/components';
-
LÍDER FUNDADOR
+
{t("hero_section.lider")}
diff --git a/src/data/locales/en.json b/src/data/locales/en.json new file mode 100644 index 0000000..e038793 --- /dev/null +++ b/src/data/locales/en.json @@ -0,0 +1,5 @@ +{ + "hero_section": { + "lider": "LÍDER FUNDADOR" + } +} \ No newline at end of file diff --git a/src/data/locales/es.json b/src/data/locales/es.json new file mode 100644 index 0000000..e038793 --- /dev/null +++ b/src/data/locales/es.json @@ -0,0 +1,5 @@ +{ + "hero_section": { + "lider": "LÍDER FUNDADOR" + } +} \ No newline at end of file diff --git a/src/data/locales/fr.json b/src/data/locales/fr.json new file mode 100644 index 0000000..e038793 --- /dev/null +++ b/src/data/locales/fr.json @@ -0,0 +1,5 @@ +{ + "hero_section": { + "lider": "LÍDER FUNDADOR" + } +} \ No newline at end of file diff --git a/src/data/locales/he.json b/src/data/locales/he.json new file mode 100644 index 0000000..f422d40 --- /dev/null +++ b/src/data/locales/he.json @@ -0,0 +1,5 @@ +{ + "hero_section": { + "lider": "מנהיג מייסד" + } +} \ No newline at end of file diff --git a/src/utils/i18n.js b/src/utils/i18n.js new file mode 100644 index 0000000..98a84ed --- /dev/null +++ b/src/utils/i18n.js @@ -0,0 +1,13 @@ +import es from '../data/locales/es.json'; +import en from '../data/locales/en.json'; +import he from '../data/locales/he.json'; +import fr from '../data/locales/fr.json'; + +const languages = { es, en, he, fr }; + +export function useTranslations(lang) { + return function t(key) { + // return the translation for the given key in the specified language, or fall back to Spanish if the key is not found + return languages[lang][key] || languages['es'][key]; + }; +} \ No newline at end of file