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!

2
  • 2
    Have you found a good implementation of organizing .arb files? I am looking into this too. Commented Jun 24, 2021 at 19:42
  • 3
    Someone filed a feature request in the flutter repo github.com/flutter/flutter/issues/107157 Commented Jul 7, 2022 at 7:44

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.