Fazbeeer commited on
Commit
a5d9863
·
verified ·
1 Parent(s): cc455f3

Hi so for the language option can you actually make it clickable and work. So let say if I click Spanish it actually translate my website to spanish

Browse files
Files changed (1) hide show
  1. index.html +149 -13
index.html CHANGED
@@ -626,21 +626,119 @@ Get Started
626
  <script src="https://unpkg.com/i18next-http-backend/i18nextHttpBackend.js"></script>
627
 
628
  <script>
629
- // Initialize i18next
630
  i18next
631
  .use(i18nextBrowserLanguageDetector)
632
- .use(i18nextHttpBackend)
633
  .init({
634
  fallbackLng: 'en',
635
  debug: false,
636
- backend: {
637
- loadPath: '/locales/{{lng}}/translation.json'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
638
  }
639
  }, function(err, t) {
640
  // Initial translations loaded
641
  updateContent();
642
  });
643
- // Language switcher
644
  const languageButton = document.getElementById('language-button');
645
  const languageDropdown = document.getElementById('language-dropdown');
646
 
@@ -667,18 +765,56 @@ Get Started
667
  languageDropdown.classList.add('hidden');
668
  }
669
  });
670
- // Update page content
671
  function updateContent() {
672
- // Translate all elements with data-i18n attribute
673
- document.querySelectorAll('[data-i18n]').forEach(el => {
674
- el.textContent = i18next.t(el.getAttribute('data-i18n'));
675
  });
676
-
677
- // Update any other dynamic text as needed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
678
  document.title = i18next.t('title');
 
 
 
679
  }
680
-
681
- // Mobile menu toggle
682
  const mobileMenuButton = document.getElementById('mobile-menu-button');
683
  const mobileMenu = document.getElementById('mobile-menu');
684
  const mobileMenuClose = document.getElementById('mobile-menu-close');
 
626
  <script src="https://unpkg.com/i18next-http-backend/i18nextHttpBackend.js"></script>
627
 
628
  <script>
629
+ // Initialize i18next with translations
630
  i18next
631
  .use(i18nextBrowserLanguageDetector)
 
632
  .init({
633
  fallbackLng: 'en',
634
  debug: false,
635
+ resources: {
636
+ en: {
637
+ translation: {
638
+ "home": "Home",
639
+ "features": "Features",
640
+ "pricing": "Pricing",
641
+ "about": "About",
642
+ "currency": "Currency",
643
+ "events": "Events",
644
+ "results": "Results",
645
+ "login": "Login",
646
+ "title": "Amplify - Mental Performance for Champions",
647
+ "hero_title": "AMPLIFY YOUR MIND",
648
+ "hero_subtitle": "VR & AR mental training for athletes and performers.",
649
+ "get_started": "Get Started",
650
+ "watch_demo": "Watch Demo",
651
+ "train_your_mind": "TRAIN YOUR MIND",
652
+ "vr_scenarios": "VR Scenarios",
653
+ "vr_desc": "Immersive virtual reality puts you in high-pressure situations before the big moment.",
654
+ "ar_training": "AR Training",
655
+ "ar_desc": "Augmented reality overlays provide real-time feedback on posture, breathing, and movement.",
656
+ "biometrics": "Biometrics",
657
+ "bio_desc": "Track heart rate, breathing patterns, and stress levels to understand your physiological responses."
658
+ // Add more translations as needed
659
+ }
660
+ },
661
+ es: {
662
+ translation: {
663
+ "home": "Inicio",
664
+ "features": "Características",
665
+ "pricing": "Precios",
666
+ "about": "Sobre nosotros",
667
+ "currency": "Moneda",
668
+ "events": "Eventos",
669
+ "results": "Resultados",
670
+ "login": "Iniciar sesión",
671
+ "title": "Amplify - Rendimiento mental para campeones",
672
+ "hero_title": "AMPLIFICA TU MENTE",
673
+ "hero_subtitle": "Entrenamiento mental con VR y AR para atletas y artistas.",
674
+ "get_started": "Comenzar",
675
+ "watch_demo": "Ver demo",
676
+ "train_your_mind": "ENTRENA TU MENTE",
677
+ "vr_scenarios": "Escenarios VR",
678
+ "vr_desc": "La realidad virtual inmersiva te coloca en situaciones de alta presión antes del gran momento.",
679
+ "ar_training": "Entrenamiento AR",
680
+ "ar_desc": "Las superposiciones de realidad aumentada proporcionan retroalimentación en tiempo real sobre postura, respiración y movimiento.",
681
+ "biometrics": "Biometría",
682
+ "bio_desc": "Monitorea ritmo cardíaco, patrones de respiración y niveles de estrés para entender tus respuestas fisiológicas."
683
+ // Add more Spanish translations as needed
684
+ }
685
+ },
686
+ fr: {
687
+ translation: {
688
+ "home": "Accueil",
689
+ "features": "Fonctionnalités",
690
+ "pricing": "Tarifs",
691
+ "about": "À propos",
692
+ "currency": "Devise",
693
+ "events": "Événements",
694
+ "results": "Résultats",
695
+ "login": "Connexion",
696
+ "title": "Amplify - Performance mentale pour les champions",
697
+ "hero_title": "AMPLIFIEZ VOTRE ESPRIT",
698
+ "hero_subtitle": "Formation mentale en VR et AR pour les athlètes et les artistes.",
699
+ "get_started": "Commencer",
700
+ "watch_demo": "Voir la démo",
701
+ "train_your_mind": "ENTRAÎNEZ VOTRE ESPRIT",
702
+ "vr_scenarios": "Scénarios VR",
703
+ "vr_desc": "La réalité virtuelle immersive vous place dans des situations de haute pression avant le grand moment.",
704
+ "ar_training": "Formation AR",
705
+ "ar_desc": "Les superpositions de réalité augmentée fournissent des commentaires en temps réel sur la posture, la respiration et le mouvement.",
706
+ "biometrics": "Biométrie",
707
+ "bio_desc": "Suivez la fréquence cardiaque, les schémas respiratoires et les niveaux de stress pour comprendre vos réponses physiologiques."
708
+ // Add more French translations as needed
709
+ }
710
+ },
711
+ de: {
712
+ translation: {
713
+ "home": "Startseite",
714
+ "features": "Funktionen",
715
+ "pricing": "Preise",
716
+ "about": "Über uns",
717
+ "currency": "Währung",
718
+ "events": "Veranstaltungen",
719
+ "results": "Ergebnisse",
720
+ "login": "Anmelden",
721
+ "title": "Amplify - Mentale Leistung für Champions",
722
+ "hero_title": "VERSTÄRKEN SIE IHREN GEIST",
723
+ "hero_subtitle": "VR- und AR-Mentaltraining für Sportler und Künstler.",
724
+ "get_started": "Loslegen",
725
+ "watch_demo": "Demo ansehen",
726
+ "train_your_mind": "TRAINIEREN SIE IHREN GEIST",
727
+ "vr_scenarios": "VR-Szenarien",
728
+ "vr_desc": "Immersives Virtual Reality versetzt Sie in Hochdrucksituationen vor dem großen Moment.",
729
+ "ar_training": "AR-Training",
730
+ "ar_desc": "Augmented-Realität-Overlays liefern Echtzeit-Feedback zu Haltung, Atmung und Bewegung.",
731
+ "biometrics": "Biometrie",
732
+ "bio_desc": "Verfolgen Sie Herzfrequenz, Atemmuster und Stresslevel, um Ihre physiologischen Reaktionen zu verstehen."
733
+ // Add more German translations as needed
734
+ }
735
+ }
736
  }
737
  }, function(err, t) {
738
  // Initial translations loaded
739
  updateContent();
740
  });
741
+ // Language switcher
742
  const languageButton = document.getElementById('language-button');
743
  const languageDropdown = document.getElementById('language-dropdown');
744
 
 
765
  languageDropdown.classList.add('hidden');
766
  }
767
  });
768
+ // Update page content with translations
769
  function updateContent() {
770
+ // Update navigation items
771
+ document.querySelectorAll('nav a[href="index.html"]').forEach(el => {
772
+ el.textContent = i18next.t('home');
773
  });
774
+ document.querySelectorAll('nav a[href="index.html#features"]').forEach(el => {
775
+ el.textContent = i18next.t('features');
776
+ });
777
+ document.querySelectorAll('nav a[href="index.html#pricing"]').forEach(el => {
778
+ el.textContent = i18next.t('pricing');
779
+ });
780
+ document.querySelectorAll('nav a[href="about.html"]').forEach(el => {
781
+ el.textContent = i18next.t('about');
782
+ });
783
+ document.querySelectorAll('nav a[href="currency.html"]').forEach(el => {
784
+ el.textContent = i18next.t('currency');
785
+ });
786
+ document.querySelectorAll('nav a[href="events.html"]').forEach(el => {
787
+ el.textContent = i18next.t('events');
788
+ });
789
+ document.querySelectorAll('nav a[href="results.html"]').forEach(el => {
790
+ el.textContent = i18next.t('results');
791
+ });
792
+ document.querySelectorAll('nav a[href="login.html"]').forEach(el => {
793
+ el.textContent = i18next.t('login');
794
+ });
795
+
796
+ // Update hero section
797
+ document.querySelector('h1 span.text-yellow-500').textContent = i18next.t('hero_title');
798
+ document.querySelector('section.hero-gradient p').textContent = i18next.t('hero_subtitle');
799
+ document.querySelector('section.hero-gradient button:nth-of-type(1)').textContent = i18next.t('get_started');
800
+ document.querySelector('section.hero-gradient button:nth-of-type(2)').textContent = i18next.t('watch_demo');
801
+
802
+ // Update features section
803
+ document.querySelector('section#features h2').textContent = i18next.t('train_your_mind');
804
+ document.querySelectorAll('section#features h3')[0].textContent = i18next.t('vr_scenarios');
805
+ document.querySelectorAll('section#features p')[2].textContent = i18next.t('vr_desc');
806
+ document.querySelectorAll('section#features h3')[1].textContent = i18next.t('ar_training');
807
+ document.querySelectorAll('section#features p')[3].textContent = i18next.t('ar_desc');
808
+ document.querySelectorAll('section#features h3')[2].textContent = i18next.t('biometrics');
809
+ document.querySelectorAll('section#features p')[4].textContent = i18next.t('bio_desc');
810
+
811
+ // Update document title
812
  document.title = i18next.t('title');
813
+
814
+ // Re-render feather icons after text changes
815
+ feather.replace();
816
  }
817
+ // Mobile menu toggle
 
818
  const mobileMenuButton = document.getElementById('mobile-menu-button');
819
  const mobileMenu = document.getElementById('mobile-menu');
820
  const mobileMenuClose = document.getElementById('mobile-menu-close');