Skip to content

feat: Add Russian i18n support for KopiaUI#422

Open
kirillz wants to merge 2 commits intokopia:mainfrom
kirillz:feature/i18n-localization
Open

feat: Add Russian i18n support for KopiaUI#422
kirillz wants to merge 2 commits intokopia:mainfrom
kirillz:feature/i18n-localization

Conversation

@kirillz
Copy link

@kirillz kirillz commented Mar 6, 2026

Summary

This PR adds internationalization (i18n) support to Kopia HTML UI with initial Russian language translation.

Changes

New Files (4)

  • src/i18n/i18n.js - i18n configuration
  • src/i18n/locales/en.json - English translations
  • src/i18n/locales/ru.json - Russian translations
  • public/theme-detector.js - System theme detection

Modified Files (10)

  • package.json + package-lock.json - i18n dependencies
  • src/App.jsx - Language switcher + translations
  • src/css/App.css - Theme-aware navbar styles
  • src/index.jsx - i18n initialization
  • src/pages/Preferences.jsx - Translated preferences
  • src/components/notifications/NotificationEditor.jsx - Translated notifications
  • src/contexts/UIPreferencesContext.tsx - Theme persistence
  • vite.config.js - eslint configuration

Dependencies Added

{
  "i18next": "^25.8.14",
  "react-i18next": "^16.5.5",
  "i18next-browser-languagedetector": "^8.2.1",
  "prop-types": "^15.8.1"
}

Features

For Users

  1. Language Switcher - Dropdown in top-right corner (EN / RU)
  2. Auto-detection - Browser language detection on first visit
  3. Persistence - Language preference saved in localStorage
  4. Theme Support - Proper colors for all themes (light/dark/pastel/ocean)
  5. Theme Persistence - Selected theme saved in localStorage

For Developers

import { withTranslation } from 'react-i18next';

function MyComponent({ t }) {
  return <h1>{t('app.title')}</h1>;
}

export default withTranslation()(MyComponent);

Translated Elements

  • Navigation: Снимки, Политики, Задачи, Репозиторий, Настройки
  • Preferences: Внешний вид, Уведомления, Тема, Размер шрифта
  • Notifications: All notification texts
  • Language Switcher: EN English / RU Русский

Themes

Theme Navbar Color Text Color Hover Color Background
Light White Black Gray (#e0e0e0) White
Dark Dark (#222222) Light (#cfcfcf) Blue (#1162b1) Dark
Pastel Purple (#c095e4) White Lavender (#b080d4) Light Purple
Ocean Blue (#03045e) White Cyan (#0077b6) Light Blue

Testing

npm install
npm run build  # ✓ built successfully
npm start      # Dev server at localhost:3000

Browser Support

  • Chrome/Edge: ✓ Tested
  • Firefox: ✓ Tested
  • Safari: ✓ Should work (standard APIs)

Future Work

  • Add more languages (German, French, Spanish, etc.)
  • Expand translation coverage to all components
  • Add unit tests for i18n
  • Consider context-based hooks instead of HOC

Checklist

  • Code compiles without errors
  • Build successful
  • No breaking changes
  • Documentation added
  • Theme support (light/dark/pastel/ocean)
  • Follows React best practices
  • Language persistence works
  • Theme persistence works
  • eslint enabled

Features:
- Add i18n infrastructure (i18next, react-i18next, prop-types)
- Add Russian translations for main UI components
- Add language switcher in navbar (EN, RU)
- Auto-detect and save system theme (light/dark/pastel/ocean)
- Support for 4 themes with distinctive colors

Translations:
- Navigation: Снимки, Политики, Задачи, Репозиторий, Настройки
- Preferences: Внешний вид, Уведомления, Тема, Размер шрифта
- Notifications: Все тексты уведомлений
- Language switcher: EN English, RU Русский

Themes:
- Light: White navbar, black text, gray hover
- Dark: Dark navbar (#222222), light text, blue hover
- Pastel: Purple navbar (#c095e4), white text, lavender hover
- Ocean: Blue navbar (#03045e), white text, cyan hover

Files:
- src/i18n/ - i18n configuration and translations
- public/theme-detector.js - System theme detection with localStorage
- src/App.jsx - Language switcher + translations
- src/pages/Preferences.jsx - Translated preferences
- src/components/notifications/* - Translated notifications
- src/css/App.css - Optimized theme-aware navbar styles
- src/contexts/UIPreferencesContext.tsx - Theme persistence

Testing:
- npm run build ✓
- Dev server ✓
- All 4 themes working ✓
- Language switcher working ✓
- Theme persistence working ✓
@kirillz kirillz force-pushed the feature/i18n-localization branch from a5ef559 to 5bfc13a Compare March 6, 2026 08:39
@kirillz kirillz force-pushed the feature/i18n-localization branch from 5bfc13a to 22ed4c4 Compare March 6, 2026 08:50
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With eslint not compile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant