1. Home
  2. Docs
  3. Listar FluxPro
  4. Mobile App
  5. Language

Language

To ensure proper language support in your application, follow these steps. First, locate the folder corresponding to your language list in the ./assets/locale/.. directory and place your JSON language file in it. Next, open the ./lib/configs/language.dark file and specify the list of supported languages. This will ensure that your application can adequately display the desired language for your users.

Settings Language

import 'package:flutter/material.dart';
class AppLanguage {
    ///Default Language
    static const Locale defaultLanguage = Locale("en");

    ///List Language support in Application
    static final List<Locale> supportLanguage = [
    const Locale("en"),
    const Locale("vi"),
    const Locale("ar"),
    const Locale("da"),
    const Locale("de"),
    const Locale("el"),
    const Locale("fr"),
    const Locale("he"),
    const Locale("id"),
    const Locale("ja"),
    const Locale("ko"),
    const Locale("lo"),
    const Locale("nl"),
    const Locale("zh"),
    const Locale("fa"),
    const Locale("km"),
    const Locale("pt"),
    const Locale("ru"),
    const Locale("tr"),
    const Locale("hi"),
    const Locale("es"),
  ];
  .....
}

Open the file ./source/lib/utils/language.dart and add full names from the JSON language files based on the language code.

///Get Language Global Language Name
  static String getGlobalLanguageName(String code) {
    switch (code) {
      case 'en':
        return 'English';
      case 'vi':
        return 'Vietnamese';
      case 'ar':
        return 'Arabic';
      case 'da':
        return 'Danish';
      case 'de':
        return 'German';
      case 'el':
        return 'Greek';
      case 'fr':
        return 'French';
      case 'he':
        return 'Hebrew';
      case 'id':
        return 'Indonesian';
      case 'ja':
        return 'Japanese';
      case 'ko':
        return 'Korean';
      case 'lo':
        return 'Lao';
      case 'nl':
        return 'Dutch';
      case 'zh':
        return 'Chinese';
      case 'fa':
        return 'Iran';
      case 'km':
        return 'Cambodian';
      case 'pt':
        return 'Brazilian - Portuguese';
      case 'ru':
        return 'Russian';
      case 'tr':
        return 'Turkish';
      case 'hi':
        return 'Indian';
      case 'es':
        return 'Spanish';

      default:
        return 'Unknown';
    }
  }

RTL Layout

To apply the RTL (Right-to-Left) layout, you must define the language code in the file at ./source/lib/utils/language.dart. This is particularly useful if you’re designing a product for a language written from right to left, such as Arabic or Hebrew. By doing so, you can ensure that your product’s text and visual elements are aligned correctly and that the user can easily navigate and interact with the interface.

///isRTL layout
  static bool isRTL() {
    switch (AppLanguage.defaultLanguage.languageCode) {
      case "ar":
      case "he":
        return true;
      default:
        return false;
    }
  }
Language Settings
JSON Language Settings