Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiLanguage Facility #469

Merged
merged 4 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/components/Hero/Hero.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useEffect } from 'react';
import Typed from 'typed.js';
import Earth from '../3D_Models/Earth/Earth.jsx'
import Styles from './Hero.module.css'
import Earth from '../3D_Models/Earth/Earth.jsx';

function Hero() {
useEffect(() => {
Expand All @@ -22,7 +21,7 @@ function Hero() {
return (
<div className="container col-xxl-9 px-3 py-5 override-display">
<div className="row flex-lg-row-reverse align-items-center g-5 py-5">
<div className="col-10 col-sm-8 col-lg-6 flex justify-center " id={Styles['earth']}>
<div className="col-10 col-sm-8 col-lg-6 flex justify-center" id="earth">
<Earth />
</div>
<div className="col-lg-6">
Expand All @@ -39,4 +38,4 @@ function Hero() {
);
}

export default Hero;
export default Hero;
1 change: 1 addition & 0 deletions src/components/Hero/Hero.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
margin: 0;
margin-top: 5%;
}

}
26 changes: 26 additions & 0 deletions src/components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,29 @@ function Navbar() {
}
};

useEffect(() => {
const loadGoogleTranslate = () => {
new window.google.translate.TranslateElement(
{
pageLanguage: 'en',
includedLanguages: 'en,hi,pa,sa,mr,ur,bn,es,fr,de,it',
layout: window.google.translate.TranslateElement.InlineLayout.SIMPLE,
},
'google_element'
);
};

const script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://translate.google.com/translate_a/element.js?cb=loadGoogleTranslate';
script.onerror = () => console.error('Error loading Google Translate script');
document.body.appendChild(script);

return () => {
document.body.removeChild(script);
};
}, []);

return (
<nav className="navbar">
<div className="logo">
Expand All @@ -125,6 +148,9 @@ function Navbar() {
<NavLink className={({ isActive }) => ("rem-default " + (isActive ? ' active' : ''))} to="/login">AstroAccess</NavLink>
</li>
{renderContactLink()}
<li className="navbar-list-item" onClick={handleMenuClose}>
<div id="google_element"></div>
</li>
</ul>
</div>
<div className="hamburger" id="hamburger" onClick={toggleMenu} aria-label="Menu">
Expand Down
Loading