Skip to content

Add support for multiple package project #23

@remonh87

Description

@remonh87

Is your feature request related to a problem? Please describe.
This library really works great and generates a lot of boiler plate code. Unfortunately it works perfect for a single package app but does not support monorepo. For example:
I have a package called app_ui and my translation assets are located in: lib/app_ui/translations. In the pubspec.yaml I declare my assets like: packages/app_ui/i18n/en.json . My main is located in the app_main package.
The rosetta generator is able to find my file, can generate the code, but does not generate the proper code for loading the asset. When I start the app it crashes because rootbundle cannot load the translated file.

Describe the solution you'd like
Add support for the package name, for example:
@Stone(path: 'lib/i18n', package: "app_ui") class Translation with _$TranslationHelper { ... }

Based on this the rosetta_generator can generate the following snippet in the translationhelper:
var jsonStr = await rootBundle.loadString("packages/app_ui/i18n/${locale.languageCode}.json");

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions