AppFlowy Docs
Searchโ€ฆ
โ˜Ž
Translate AppFlowy
You can help Appflowy in supporting various languages by contributing. Follow the steps below sequentially to contribute translations.

Steps to modify an existing translation

Translation files are located in : frontend/app_flowy/assets/translations/
  1. 1.
    Modify the specific translation file.
  2. 2.
    Run flutter pub run easy_localization:generate -S assets/translations/
  3. 3.
    Run flutter pub run easy_localization:generate -f keys -o locale_keys.g.dart -S assets/translations
  4. 4.
    Verify that the translation has changed appropriately by compiling and running the app.

Steps to add new language

NOTE: Translation files SHOULD be json files named in the format <lang_code>-<country_code>.json or just <lang_code>.json. eg:en.json, en-UK.json
  1. 1.
    Add language key-value json file to frontend/app_flowy/assets/translations/. Refer en.json for format and keys.
  2. 2.
    Run flutter pub run easy_localization:generate -S assets/translations/
  3. 3.
    Run flutter pub run easy_localization:generate -f keys -o locale_keys.g.dart -S assets/translations
  4. 4.
    Open the frontend/app_flowy/lib/startup/tasks/app_widget.dart file.
  5. 5.
    In the InitAppWidgetTask class, add the locale of the language you just created (eg: Locale('en', 'IN'), Locale('en')) to the supportedLocales List :
    1
    runApp(
    2
    EasyLocalization(
    3
    supportedLocales: const [Locale('en'), Locale('zh', 'CN')], // <---- Add locale to this list
    4
    path: 'assets/translations',
    5
    fallbackLocale: const Locale('en'),
    6
    child: app),
    7
    );
    Copied!
  6. 6.
    Add the name of your language, in your native tongue, to the list of language names in AppFlowy/frontend/app_flowy/packages/flowy_infra/lib/language.dart
    1
    String languageFromLocale(Locale locale) {
    2
    switch (locale.languageCode) {
    3
    // Most often used
    4
    case "en":
    5
    return "English";
    6
    case "zh":
    7
    return "็ฎ€ไฝ“ไธญๆ–‡";
    8
    โ€‹
    9
    // Then in alphabetical order
    10
    case "de":
    11
    return "Deutsch";
    12
    case "es":
    13
    return "Espaรฑol";
    14
    case "fr":
    15
    return "Franรงais";
    16
    โ€‹
    17
    // <- add your language here.
    18
    โ€‹
    19
    // If not found then the language code will be displayed
    20
    default:
    21
    return locale.languageCode;
    22
    }
    23
    }
    Copied!

How to test your changes

Once your language is added to the language picker, you can simply choose it.