Make the resume bilingual and part of the shared site chrome
Adds a Russian version (data/resume.ru.json, default language) with an RU/EN switch stored under the key shared with the front page and the portfolio. The top bar becomes the site-wide one (brand, Resume, Portfolio, Gitea, Contact, language, theme) with a second row of anchors for this page's sections, and the fonts move to Unbounded and Onest so the three pages share one type system. Portfolio links now point at /portfolio/. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XtcZtnG4GQA1d6mW5PNrS9
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
'use client'
|
||||
|
||||
import { useLang } from '@/lib/useLang'
|
||||
import type { Lang } from '@/lib/i18n'
|
||||
import styles from './topbar.module.css'
|
||||
|
||||
/** RU / EN switch. The choice is stored under the key shared with the rest of shanaty.ru. */
|
||||
export default function LangSwitch() {
|
||||
const lang = useLang()
|
||||
const choose = (next: Lang) => {
|
||||
const html = document.documentElement
|
||||
html.dataset.lang = next
|
||||
html.lang = next
|
||||
document.title = html.getAttribute(`data-title-${next}`) ?? document.title
|
||||
try {
|
||||
localStorage.setItem('lang', next)
|
||||
} catch {
|
||||
// Storage can be blocked; the language still changes for this visit.
|
||||
}
|
||||
window.dispatchEvent(new Event('langchange'))
|
||||
}
|
||||
return (
|
||||
<div className={styles.seg} role="group" aria-label={lang === 'ru' ? 'Язык' : 'Language'}>
|
||||
{(['ru', 'en'] as const).map((code) => (
|
||||
<button key={code} type="button" aria-pressed={lang === code} onClick={() => choose(code)}>
|
||||
{code.toUpperCase()}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user