Files
ui/src/i18n/i18n.ts
T
Armen Rohalov cfffb4bdd7
ci/woodpecker/push/build-arm Pipeline failed
settings v2: implement design
- Rewrite SettingsPage to 5-panel v2 layout: Tenant, Directories,
  Aircrafts, Language, Session — corner-bracket panels, sticky footer
  pinned to viewport bottom (Cancel + Save Changes), live dirty-state
  indicator.
- Wire try/catch/finally + role="alert" in save handler so AZ-477's
  three it.fails contract tests flip to passing; remove the obsolete
  v1-drift control test and its unhandledRejection harness.
- Add EN/UA language toggle; persist to localStorage('azaion.lang')
  and read on i18n init. Export LANG_STORAGE_KEY from src/i18n.
- Add Add-Aircraft flow (reuses admin Modal) and view-only star
  default toggle.
- Extend the v2 design system with .btn-danger-ghost, .star,
  .path-wrap/.browse classes. Scope settings.html-spec button
  proportions (padding 7px 14px, weight 400, letter-spacing 0.10em,
  line-height 1.5) under .settings-page so the admin spec is unaffected.
- Restore module-scoped bootstrapInflight declaration in
  src/auth/AuthContext.tsx (deleted in 2a62415 while references
  remained — every test using tests/setup.ts was throwing
  ReferenceError).
2026-05-26 00:25:27 +03:00

26 lines
698 B
TypeScript

import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import en from './en.json'
import ua from './ua.json'
export const LANG_STORAGE_KEY = 'azaion.lang'
function readPersistedLanguage(): 'en' | 'ua' {
// Safari private mode throws on localStorage access — fall back to 'en'.
try {
const persisted = localStorage.getItem(LANG_STORAGE_KEY)
return persisted === 'ua' || persisted === 'en' ? persisted : 'en'
} catch {
return 'en'
}
}
i18n.use(initReactI18next).init({
resources: { en: { translation: en }, ua: { translation: ua } },
lng: readPersistedLanguage(),
fallbackLng: 'en',
interpolation: { escapeValue: false },
})
export default i18n