FlutterGen / flutter_gen

The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.
https://pub.dev/packages/flutter_gen
MIT License
1.46k stars 146 forks source link

[FR]: Add Localized Asset Generation #436

Closed ricardodalarme closed 6 months ago

ricardodalarme commented 11 months ago

Is there an existing issue for this?

Describe the problem

Currently, FlutterGen is a fantastic tool for generating code related to assets, fonts, colors, and APIs in Flutter applications. However, it lacks the capability to generate localized assets easily.

In many internationalized applications, it's essential to provide localized versions of assets like images, with different languages or regions using the same asset but tailored to their needs. For instance, a logo used in English-speaking regions may be different from the one used in Portuguese-speaking regions.

This feature request aims to address this limitation by adding the ability to generate localized assets using FlutterGen.

Describe the solution

The solution involves enhancing FlutterGen to recognize and generate assets from localized directories. Specifically, it should:

  1. Recognize language or region-specific directories within the assets directory, such as /assets/en for English and /assets/pt for Portuguese.

  2. Allow users to provide assets in these localized directories. For example:

    • /assets/en/logo.png for the English version of the logo.
    • /assets/pt/logo.png for the Portuguese version of the logo.
  3. Generate code that makes it easy to access these localized assets in Flutter, ensuring that the correct asset is used based on the application's current locale.

Additional context

No response

Code of Conduct

AlexV525 commented 6 months ago

Should be a duplicate of #281

alexkater commented 3 months ago

@AlexV525 there is any reason to close as not planned?

Thanks in advance, amazing work!