diff --git a/TRANSLATIONS.md b/TRANSLATIONS.md index 4a740f47..8121e128 100644 --- a/TRANSLATIONS.md +++ b/TRANSLATIONS.md @@ -4,10 +4,18 @@ Thank you for your interest in helping translate Resonate! This guide will walk ## Overview -Resonate uses Flutter's internationalization (i18n) framework with ARB (Application Resource Bundle) files to manage translations. Currently, the app supports: +Resonate uses Flutter's internationalization (i18n) framework with ARB (Application Resource Bundle) files to manage translations. Currently, the app supports the following 10 languages: +- **Bengali (bn)** - ~96% translated - **English (en)** - Primary language (template) -- **Hindi (hi)** - Secondary language +- **Gujarati (gu)** - ~91% translated +- **Hindi (hi)** - ~99% translated +- **Kannada (kn)** - ~91% translated +- **Malayalam (ml)** - 100% translated +- **Marathi (mr)** - 100% translated +- **Punjabi (pa)** - 100% translated +- **Rajasthani (raj)** - ~95% translated +- **Tamil (ta)** - ~98% translated ## Getting Started @@ -46,8 +54,9 @@ lib/l10n/ ### Configuration Files -- **`l10n.yaml`** - Configuration file for Flutter's localization system -- **`untranslated.txt`** - Lists untranslated messages (auto-generated) +- **`l10n.yaml`** - Configuration file for Flutter's localization system (located in the project root directory) +- **`untranslated.txt`** - Lists untranslated messages (auto-generated in the project root directory when `flutter gen-l10n` is run) +- **`app_localizations.dart` and `app_localizations_.dart`** - Generated by `flutter gen-l10n` under `lib/l10n/`; do not edit these files manually ## Adding a New Language @@ -69,18 +78,17 @@ lib/l10n/ ### Step 2: Register Your Language in App Configuration -Before translating, you need to register your new language in the app's configuration files: +Unlike other setups, you do **not** need to manually register the new language in `l10n.yaml`. +Flutter's localization tool automatically scans `lib/l10n/` for any `app_*.arb` files and generates support for them. -#### Update main.dart +However, you must still register the language for **iOS** and generate the files: -Add your language code to the `supportedLocales` list in `lib/main.dart`: +#### Generate Localization Files -```dart -supportedLocales: [ - Locale('en'), - Locale('hi'), - Locale('YOUR_LANGUAGE_CODE'), // Add your language here -], +Run the generator so the app recognizes the new locale: + +```bash +flutter gen-l10n ``` #### Update iOS Configuration (iOS only) @@ -90,20 +98,24 @@ Add your language code to the `CFBundleLocalizations` array in `ios/Runner/Info. ```xml CFBundleLocalizations - hi + en - YOUR_LANGUAGE_CODE + hi + YOUR_LANGUAGE_CODE + ``` **Note:** -- The order in both files doesn't matter, but it's recommended to maintain alphabetical order for consistency. -- For Android, no additional configuration is needed as Flutter automatically detects supported locales from the ARB files. +- The order in `Info.plist` doesn't matter, but it's recommended to maintain alphabetical order for consistency. +- For Android, no additional configuration is needed. ### Step 3: Translate the Content Open your new ARB file and translate each string value while keeping the keys unchanged. +Only edit the ARB source files in `lib/l10n/`. Do not manually edit the generated `app_localizations.dart` file or any `app_localizations_.dart` file. + #### Example Translation Structure: ```json { @@ -173,7 +185,7 @@ Translate each option while maintaining the structure: ``` 3. **Check for untranslated strings:** - - Review the generated `untranslated.txt` file + - Review the generated `untranslated.txt` file in the project root directory - Ensure all required strings are translated ### Step 6: Quality Assurance @@ -202,18 +214,19 @@ flutter gen-l10n cat untranslated.txt ``` +The generated localization Dart files update after `flutter gen-l10n`; that output is the source of truth for supported locales and translated getters. + ## Submitting Your Translation ### Step 1: Commit Your Changes ```bash -git add lib/l10n/app_YOUR_LANGUAGE_CODE.arb lib/main.dart ios/Runner/Info.plist +git add lib/l10n/app_YOUR_LANGUAGE_CODE.arb ios/Runner/Info.plist git commit -m "feat: add YOUR_LANGUAGE translation support - Added complete translation for YOUR_LANGUAGE (YOUR_LANGUAGE_CODE) - Translated all UI strings and messages - Maintained placeholder and metadata structure -- Updated supportedLocales in main.dart - Added language to iOS CFBundleLocalizations" ``` @@ -251,7 +264,24 @@ To update an existing translation: ## Language Codes Reference -Use standard language codes (ISO 639-1) for your translations: +Use standard language codes (typically ISO 639-1) for your translations: + +### Currently Supported Languages + +| Language | Code | Example File | +| -------------------- | ----- | ------------ | +| Bengali | bn | app_bn.arb | +| English (Template) | en | app_en.arb | +| Gujarati | gu | app_gu.arb | +| Hindi | hi | app_hi.arb | +| Kannada | kn | app_kn.arb | +| Malayalam | ml | app_ml.arb | +| Marathi | mr | app_mr.arb | +| Punjabi | pa | app_pa.arb | +| Rajasthani | raj | app_raj.arb | +| Tamil | ta | app_ta.arb | + +### Other Common Languages (To Be Added) | Language | Code | Example File | | -------------------- | ---- | ------------ | diff --git a/l10n.yaml b/l10n.yaml index e521fbbb..05191541 100644 --- a/l10n.yaml +++ b/l10n.yaml @@ -1,10 +1,4 @@ arb-dir: lib/l10n template-arb-file: app_en.arb output-localization-file: app_localizations.dart -supported-locales: - - en - - hi - - raj - - bn - - mr untranslated-messages-file: untranslated.txt \ No newline at end of file