Open-source AI browser agent for Chrome and Firefox (monorepo) π§
Translation System
Refactored Translation System β¨
The app now has a robust, centralized translation system that updates instantly without page refresh!
Using Translations (New API)
Recommended approach - Use the useT() hook:
import { useT } from 'contexts/TranslationContext';
function MyComponent() {
const t = useT();
return (
<div>
<h1>{t('modals.main.title')}</h1>
<p>{t('modals.main.description')}</p>
</div>
);
}
Alternative - Use the full hook:
import { useTranslation } from 'contexts/TranslationContext';
function MyComponent() {
const { t, language, changeLanguage } = useTranslation();
return (
<div>
<h1>{t('modals.main.title')}</h1>
<button onClick={() => changeLanguage('es')}>EspaΓ±ol</button>
</div>
);
}
Backward Compatibility
The old variables.getMessage() method still works and is automatically reactive:
// This still works and updates on language change
const title = variables.getMessage('modals.main.title');
This allows gradual migration of components.
How It Works
- TranslationProvider wraps the app and manages the i18n instance
- Single source of truth - All translation logic is centralized in the context
- Automatic reactivity - Components using
t()automatically re-render on language change - Backward compatible -
variables.getMessage()is updated to use the context internally - No EventBus needed - Direct context updates for language changes
Benefits
β Instant updates - No page refresh needed β Single API - One consistent way to translate β Automatic re-renders - React handles updates efficiently β Minimal performance impact - Translations pre-loaded, only switching active language β Type-safe ready - Easy to add TypeScript support later β Clean architecture - Centralized translation logic
Migration Guide
Before:
const title = variables.getMessage('modals.main.title');
After:
const t = useT();
const title = t('modals.main.title');
Components Updated
Core navigation and UI:
- β TranslationContext (centralized API)
- β Radio component (language selector)
- β Tab, Tabs (sidebar navigation)
- β ModalTopBar (breadcrumbs)
- β Settings view
- β Language section
- β Refresh button
- β Welcome modal
All other components continue to work via backward compatibility.