Organise .arb files in flutter using Flutter intl extension
Asked Answered
V

2

22

Running Flutter Intl: Initialize generates lib/l10n/intl_en.arb. However due to many strings in my applications I would wish to have multiple arb files for same language.

To make it more clear, consider the following folder structure

 -->lib
    --> screens
        --> screen_a.dart
        --> screen_b.dart

Correspondingly I would have my l10n folder structure as follows:

--> l10n
   --> screen_a
       --> intl_en.dart
       --> intl_fr_FR.dart
   --> screen_b
       --> intl_en.dart
       --> intl_fr_FR.dart

How do I achieve this using flutter intl plugin?
Thanks in advance!

Vig answered 24/12, 2020 at 15:23 Comment(2)
Have you found a good implementation of organizing .arb files? I am looking into this too.Aswan
Someone filed a feature request in the flutter repo github.com/flutter/flutter/issues/107157Engstrom
T
3

Package Intl_translation can handle multiple arb source files since 0.17.5:

Allow multiple ARB files with the same locale and combine their translations.

Tyson answered 7/9, 2021 at 14:8 Comment(0)
P
0

This project may be of help.

It might be a drawback to some that it uses the go-language to generate localisation files.

It follows the flutter_localizations style, in how the translations are written and documented as well as the generated files.

The added advantage is that it supports grouping of localizations not only by the folders but also supports grouping by feature (or whatever you would like to group the localizations by) so that they can be referenced as follows: AppLocalizations.of(context)!.profile.name

Check out this example for more information on how this works.

I hope it helps.

Project answered 7/11, 2023 at 13:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.