Jesway / flutter_translate

Flutter Translate is a fully featured localization / internationalization (i18n) library for Flutter.
MIT License
403 stars 118 forks source link

Question: How do I use this library in a multi package project? #77

Closed laynor closed 2 years ago

laynor commented 3 years ago

We are using flutter_translate in our project. We have a library and multiple apps that use the library. Both contain strings that we want internationalized, so we have translation files in both

What is the correct way to setup such a project?

bratan commented 3 years ago

This scenario is currently not possible since the library loads localization files from a single source/directory, specified by the basePath property, so is not possible to load from multiple sources without additional implementation.

One way would be to combine the localization files into a single file which you can use directly from the applications (ex: app_pkg1/assets/i18n). The downside is the maintenance of the library localizations as basically every app must contain them, but is a simple/quick to implement solution.