Documentation Index
Fetch the complete documentation index at: https://grantmaster.dev/llms.txt
Use this file to discover all available pages before exploring further.
Internationalization (i18n) Workflow
GrantMaster targets a global audience of NGOs. This document details how to manage translations and add support for new languages.🏗️ The i18next Setup
We use react-i18next for translation management.
- Logic:
src/shared/i18n/index.ts - Translations:
public/locales/{lang}/common.json - Hook:
useTranslation()from the library.
🚶 Adding a New String
- Identify the Key: Use a descriptive, hierarchical key (e.g.,
grants.details.deadline). - Add to English: Open
public/locales/en/common.jsonand add the new key/value. - Add to Other Languages: (Optional but recommended) Add the key to
es,fr, etc. If skipped, the system will fallback to English. - Use in Code:
🌍 Supported Locales
en: English (Source of Truth)es: Spanishfr: Frenchde: German
🛠️ Specialized i18n Features
1. Variables and Pluralization
Do not concatenate strings. Use variables.- JSON:
"userCount": "{{count}} users connected" - Code:
t('userCount', { count: 5 })
2. Date and Currency Localization
Use the globalFormatUtility class:
FormatUtility.currency(100, 'EUR'): Returns100,00 €or$100.00based on locale.FormatUtility.date(date): Uses the browser’s locale to format the date string.
3. RTL (Right-to-Left) Support
For languages like Arabic or Hebrew:- The
LanguageServicetoggles adir="rtl"attribute on the<html>tag. - Use CSS Logical Properties (e.g.,
margin-inline-startinstead ofmargin-left) to ensure layouts flip automatically.
🚀 Translation Workflow for Non-Developers
SuperAdmins can review and edit translations via the Localization Hub in the SuperAdmin dashboard. These changes are saved to atranslations_overrides collection in Firestore, which the app merges into the static JSON files at runtime.