> For the complete documentation index, see [llms.txt](https://edentech.gitbook.io/glover/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://edentech.gitbook.io/glover/flutter-app/custom-translation.md).

# Custom Translation \~ 1.4.8

You can translate the app to your own language if its not listed as one of the supported languages.

Here is how you can translate it yourself.

* Go to **lib/widgets/cards/language\_selector.view\.dart**
* Scroll to the bottom of the file, you would see  a commented code. like this:&#x20;

```dart
// MenuItem(
//   title: "LANGUAGE_NAME",
//   suffix: Flag('COUNRTY_CODE', height: 24, width: 24),
//   onPressed: () => onSelected('LANGUAGE_CODE'),
// ),
```

* Uncomment this code and change variable to match your new translation language. For example if you want to translate app to **Yoruba(**&#x41; local language in Nigeri&#x61;**).** Below is the sample of how the code should look like:

```dart
MenuItem(
 title: "Yoruba",
 suffix: Flag('NG', height: 24, width: 24),
 onPressed: () => onSelected('yo'),
),
```

Now **Yoruba** will be listed as one of the app languages.

## Translating App Strings

After setting your custom language option above, all you are left with is to translate all the used strings used in the app to your custom language.

All translatable strings/values used in the app is grouped inside a **translation** folder. For example if you want to translate the values on the splash page. Navigate to **lib/translations/splash.i18n.dart.**&#x20;

Here is a the content of **splash.i18n.dart:**

```dart
import 'package:i18n_extension/i18n_extension.dart';

extension Localization on String {
  //en,fr,es,de
  static var _t = Translations("en") +
      {
        "en": "Loading Please wait...",
        "fr": "",
        "es": "",
        "de": "",
      };

  String get i18n => localize(this, _t);
  String fill(List<Object> params) => localizeFill(this, params);
}

```

Now you need to set your translated string/value for each object.&#x20;

Now let us translation the value  **"**&#x4C;oading Please wait..." to **Yoruba.** This is how the file would now look like:

```dart
import 'package:i18n_extension/i18n_extension.dart';

extension Localization on String {
  //en,fr,es,de
  static var _t = Translations("en") +
      {
        "en": "Loading Please wait...",
        "fr": "",
        "es": "",
        "de": "",
        "yo": "Nbọ Jọwọ duro ...",
      };

  String get i18n => localize(this, _t);
  String fill(List<Object> params) => localizeFill(this, params);
}

```

That's it, you now have a translated version of that value. You can follow the guide above to translate the rest values in all the translation files.&#x20;

**NOTE:** All translation file as an extension of **.i18n.dart**

## **Default Language**

You can make the newly added language the default language of the app.

Navigate to **lib/services/auth.service.dart.** Change the code at line 39. Current code from line 39

```dart
static String getLocale() { 
    return LocalStorageService.prefs.getString(AppStrings.appLocale) ?? "en"; 
}
```

To make **Yoruba** our default language, change the **"en"** to **"yo".**&#x20;

Also add your custom language to list of allowed languages in the **MyApp.dart file.** Adding **Yoruba** as one of the supported languages.

```dart
supportedLocales: [
    const Locale('en'),
    const Locale('fr'),
    const Locale('es'),
    const Locale('de'),
    //FOR YORUBA
    const Locale('yo'),
],
```

## REMOVE LANGUAGE

If you need to remove unwanted languages, you can simply comment out the MenuItem for the language in the **lib/widgets/cards/language\_selector.view\.dart**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://edentech.gitbook.io/glover/flutter-app/custom-translation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
