Language Customisation

Below is the file structure to reach the file for adding or removing language.

├── docs
└── FlutKit
│   ├── android
│   ├── assets
         └── images
         └── lang                        // Add any language json file here
               ├── ar.json
               ├── en.json
               ├── fr.json
│   ├── ios
│   ├── lib
│       └── apps
│       └── extensions
│       └── homes
│       └── localizations
│             ├── app_localization_delegate.dart          // Add this file for localization
│             ├── language.dart          // Add any language here
│             ├── translator.dart

Modify Language

Add or Remove Language
class Language {
        static List<Language> languages = 
            Language(Locale('en'), "English"),
            Language(Locale('hi'), "Hindi"),
            Language(Locale('ar'), "Arabic", true,),
            Language(Locale('fr'), "French"),
            Language(Locale('zh'), "Chinese"),
            ...                                   // Add or remove any language here

Language File

Modify Language file

Add this type of new json file in the above given file structure to use your newly added language.

  "dark_mode" : "Mode sombre",
  "language" : "Langue",
  "light_mode": "Mode lumière",
  "settings": "Paramètres",
  "left_to_right": "De gauche à droite",
  "right_to_left": "De droite à gauche",
  "changelog" : "Journal des modifications",
  "documentation": "La documentation",

This file contains map of string with different languages.

Any changes in this file modifies at all the places in the app when language is changed.

How to Translate

Using Translator
import 'package:flutter/material.dart';
import 'package:flutkit/localizations/translator.dart';  // Important to use translator

Widget getTitle(){
  return Text(Translator.translate('title'));     // Translation using translate function

Using Translator Extension (Created by FlutKit)
import 'package:flutter/material.dart';
import 'package:flutkit/extensions/string.dart';     // Important to use extension

Widget getTitle(){
  return Text('title'.tr());    // Translation using extension


If you want to use localization directly in your app, you need to add following things in your Material App.

builder: (context, child) {
return Directionality(
  textDirection: AppTheme.textDirection,
  child: child!,
localizationsDelegates: [
AppLocalizationsDelegate(context),     // Add this line and this file can be reached from the file structure above.
supportedLocales: Language.getLocales()