Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 51 additions & 21 deletions TRANSLATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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_<locale>.dart`** - Generated by `flutter gen-l10n` under `lib/l10n/`; do not edit these files manually

## Adding a New Language

Expand All @@ -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)
Expand All @@ -90,20 +98,24 @@ Add your language code to the `CFBundleLocalizations` array in `ios/Runner/Info.
```xml
<key>CFBundleLocalizations</key>
<array>
<string>hi</string>

<string>en</string>
<string>YOUR_LANGUAGE_CODE</string> <!-- Add your language here -->
<string>hi</string>
<string>YOUR_LANGUAGE_CODE</string>

</array>
```

**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_<locale>.dart` file.

#### Example Translation Structure:
```json
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
```

Expand Down Expand Up @@ -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 |
| -------------------- | ---- | ------------ |
Expand Down
6 changes: 0 additions & 6 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading