localization_lite 1.0.5 copy "localization_lite: ^1.0.5" to clipboard
localization_lite: ^1.0.5 copied to clipboard

A lightweight and easy-to-use package for multilingual support using JSON files. Simplifies adding localization in Flutter apps with minimal setup and integration

Localization Lite #

A lightweight and simple localization package for Flutter that allows you to easily manage translations using JSON files.

✨ Features #

  • πŸ“ Easy setup with JSON language files.
  • ⚑ Lightweight and fast.
  • 🌍 Support for multiple languages without regions for more simplicity (e.g., en, ar ... ).

πŸš€ Getting Started #

  1. Setup: Create a new folder called localization in your project's assets directory.
  2. Add Language Files: In the localization folder, add JSON files for each language you want to support (e.g., en.json , ar.json).
  3. Configure Assets: Add the localization files to your pubspec.yaml:
    dependencies:
     localization_lite: ^latest_version 
    
    flutter:
      assets:
        - assets/localization/
    

πŸ“– Usage #

  1. Initialization: Initialize the translation system in your main.dart file:
   await WidgetsFlutterBinding.ensureInitialized();
   await Translation.init(defaultLang: "en");

πŸ“ note You can also add a custom path to the json by adding the path argument to the init fn. But when add custom path don't forget to add it to the pubspec.yaml dart file:

   await WidgetsFlutterBinding.ensureInitialized();
   await Translation.init(defaultLang: "en",path: "myCustomPath");
 flutter:
    assets:
      - myCustomPath/
  1. Access Translations: Use the Translation class to retrieve translated strings:
String greeting = Translation("greetingKey").toString();

or

String greeting = tr("greetingKey");

πŸ’‘Example #

Check out the /example folder for a complete example showing how to set up and use the package.

πŸ“¬ Additional Information #

For more information on contributing, filing issues, or requesting new features, please check the GitHub repository. Contributions are welcome, and any feedback or improvements are appreciated!

12
likes
0
points
32
downloads

Publisher

verified publisherhcody.com

Weekly Downloads

A lightweight and easy-to-use package for multilingual support using JSON files. Simplifies adding localization in Flutter apps with minimal setup and integration

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on localization_lite