SocialAffluence is an advanced crowd flow analysis platform powered by AI.
This project supports multiple languages using react-i18next. Currently supported languages:
- French (fr) - Default language
- English (en)
-
Create translation file: Add a new JSON file in
client/src/locales/
for your language code (e.g.,es.json
for Spanish). -
Add translations: Copy the structure from
fr.json
oren.json
and translate all the text values:
{
"navigation": {
"features": "Características",
"pricing": "Precios",
// ... other translations
},
"hero": {
"title": "Monitorea el flujo de personas en",
"titleHighlight": "tiempo real"
// ... other translations
}
// ... rest of the structure
}
- Update i18n configuration: Add your new language to
client/src/i18n.ts
:
// Import your translation file
import es from './locales/es.json';
const resources = {
fr: { translation: fr },
en: { translation: en },
es: { translation: es }, // Add your language here
};
- Update LanguageSwitcher: Modify
client/src/components/LanguageSwitcher.tsx
to include your new language button:
<Button
variant={currentLanguage === 'es' ? 'default' : 'ghost'}
size="sm"
onClick={() => changeLanguage('es')}
// ... styling and aria-label
>
ES
</Button>
- Test: Start the development server with
npm run dev
and verify that the language switching works correctly.
The system automatically detects user language preference in this order:
- localStorage (saved preference)
- Browser language
- HTML lang attribute
- URL path/subdomain
- Fallback to French (default)
The translation keys are organized by sections:
navigation.*
- Header navigation linkshero.*
- Main hero section contentfeatures.*
- Product features sectionexamples.*
- Use case examples carouselabout.*
- About/technology sectioncta.*
- Call-to-action sectionfooter.*
- Footer contentpricing.*
- Pricing page content
To run the development server:
npm run dev
To build the project:
npm run build
- React 18 with TypeScript
- Vite for build tooling
- react-i18next for internationalization
- Tailwind CSS for styling
- Express.js backend
- PostgreSQL database