generated from koinos/koinos-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add localization #131
Open
brklyn8900
wants to merge
23
commits into
master
Choose a base branch
from
129-localization
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add localization #131
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
2135f1c
#129: erros with i18n
brklyn8900 c13937b
#129: working en/es, need to translate the remaining components/pages
brklyn8900 31215c9
#129: fix package-lock.json
brklyn8900 103cc6b
#129: testing localization
brklyn8900 3c85a18
#129: fix svg icons, revert blog section
brklyn8900 5c39ef5
#129: landing page complete
brklyn8900 718a0e5
#129: footer complete
brklyn8900 684c20b
#129: add ecosystem intl
brklyn8900 d6bf900
#129: change configuration
brklyn8900 d7f28c1
#129: add whitepaper intl
brklyn8900 3b3c52b
#129: add faqs
brklyn8900 d11f0cb
#129: fix naming conventions
brklyn8900 901100b
#129: start programs translations
brklyn8900 2bd2122
#129: programs translation working, need to apply to state store
brklyn8900 f6017ef
#129: resolve conflicts
brklyn8900 358c6a7
#129: start to refactor programStore
brklyn8900 4071e9b
#129: add koindxFarm
brklyn8900 afea5d5
#129: need to fix taskon quest launch
brklyn8900 a5d17e7
#129: need to fix featured program
brklyn8900 5aa565a
#129: fix featured programs
brklyn8900 1622a8c
#129: add new languages
brklyn8900 11d1134
#129: fix subtitle in hero
brklyn8900 c4fca34
#129: match dropdown for language selection, translate media page, fi…
brklyn8900 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,43 @@ | ||
import Link from "next/link" | ||
import { useRouter } from "next/router" | ||
import { useTranslations } from 'next-intl' | ||
import { useState } from 'react' | ||
|
||
export default function Menu() { | ||
const router = useRouter(); | ||
const router = useRouter() | ||
const t = useTranslations('Menu') | ||
const [isLangDropdownOpen, setIsLangDropdownOpen] = useState(false) | ||
|
||
const toggleLangDropdown = () => { | ||
setIsLangDropdownOpen(!isLangDropdownOpen) | ||
} | ||
|
||
return ( | ||
<> | ||
|
||
<ul className="wsmenu-list nav-theme"> | ||
|
||
<li aria-haspopup="true"> | ||
<Link href="#" className="h-link">Learn<span className="wsarrow" /></Link> | ||
<Link href="#" locale={router.locale} className="h-link">{t('learn')}<span className="wsarrow" /></Link> | ||
<ul className="sub-menu"> | ||
<li aria-haspopup="true"><Link href="/whitepaper">Whitepaper</Link></li> | ||
<li aria-haspopup="true"><Link href="/#features">Features</Link></li> | ||
<li aria-haspopup="true"><Link href="/faqs">FAQs</Link></li> | ||
<li aria-haspopup="true"><Link href="/whitepaper" locale={router.locale}>{t('whitepaper')}</Link></li> | ||
<li aria-haspopup="true"><Link href="/#features" locale={router.locale}>{t('features')}</Link></li> | ||
<li aria-haspopup="true"><Link href="/faqs" locale={router.locale}>{t('faqs')}</Link></li> | ||
</ul> | ||
</li> | ||
|
||
<li className="nl-simple" aria-haspopup="true"> | ||
<Link href="https://docs.koinos.io" className="h-link">Documentation</Link> | ||
<Link href="https://docs.koinos.io" locale={router.locale} className="h-link">{t('documentation')}</Link> | ||
</li> | ||
|
||
<li className="nl-simple" aria-haspopup="true"> | ||
<Link href="/ecosystem" className="h-link">Ecosystem</Link> | ||
<Link href="/ecosystem" locale={router.locale} className="h-link">{t('ecosystem')}</Link> | ||
</li> | ||
|
||
<li className="nl-simple" aria-haspopup="true"> | ||
<Link href="/#roadmap" className="h-link">Roadmap</Link> | ||
<Link href="/#roadmap" locale={router.locale} className="h-link">{t('roadmap')}</Link> | ||
</li> | ||
|
||
<li className="nl-simple" aria-haspopup="true"> | ||
<Link href="/team" className="h-link">Team</Link> | ||
<Link href="/team" locale={router.locale} className="h-link">{t('team')}</Link> | ||
</li> | ||
|
||
<li className="nl-simple" aria-haspopup="true"> | ||
|
@@ -42,6 +48,60 @@ export default function Menu() { | |
</a> | ||
</Link> | ||
</li> | ||
|
||
<li aria-haspopup="true" className="nl-simple"> | ||
<div className="language-switcher position-relative" style={{paddingTop: '1.2em'}}> | ||
<button | ||
onClick={toggleLangDropdown} | ||
className="bg-transparent border-0 text-inherit" | ||
aria-label="Toggle language" | ||
> | ||
<i className="fa-solid fa-globe text-white"></i> | ||
</button> | ||
|
||
{isLangDropdownOpen && ( | ||
<div className="lang-dropdown position-absolute shadow-sm rounded py-2" style={{ | ||
right: 0, | ||
top: '100%', | ||
minWidth: '100px', | ||
zIndex: 1000 | ||
}}> | ||
<Link | ||
href={router.asPath} | ||
locale="en" | ||
className={`d-block px-3 py-1 text-decoration-none text-left ${router.locale === 'en' ? 'active' : ''}`} | ||
onClick={() => setIsLangDropdownOpen(false)} | ||
> | ||
English | ||
</Link> | ||
<Link | ||
href={router.asPath} | ||
locale="es" | ||
className={`d-block px-3 py-1 text-decoration-none text-left ${router.locale === 'es' ? 'active' : ''}`} | ||
onClick={() => setIsLangDropdownOpen(false)} | ||
> | ||
Español | ||
</Link> | ||
<Link | ||
href={router.asPath} | ||
locale="it" | ||
className={`d-block px-3 py-1 text-decoration-none text-left ${router.locale === 'es' ? 'active' : ''}`} | ||
onClick={() => setIsLangDropdownOpen(false)} | ||
> | ||
Italiano | ||
</Link> | ||
<Link | ||
href={router.asPath} | ||
locale="fa" | ||
className={`d-block px-3 py-1 text-decoration-none text-left ${router.locale === 'es' ? 'active' : ''}`} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copy paste error? |
||
onClick={() => setIsLangDropdownOpen(false)} | ||
> | ||
فارسی | ||
</Link> | ||
</div> | ||
)} | ||
</div> | ||
</li> | ||
</ul> | ||
</> | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy paste error?
locale == 'es'
seems wrong.