Is it possible to load multiple Fluent FTL bundles for a single locale?

I'm rewritting my internationalization module to support the FTL file format instead of simple JSONs.

I was able to have these assets like this with my previous module:

  • res/lang/en-US/_.json
  • res/lang/en-US/other.json

Then I could get messages by _.hello-world, other.blah-blah...

Is Fluent bound to only one file and is it only my mind that thought it'd be useful to load multiple files for a single language?

Yes, I could concatenate the files, but this will turn debugging hard in case the files have a syntax error. The only idea I've right now is concatenate and put comments to identify to which FTL file belongs the error, like this:

# res/lang/en/foo.ftl
...

# res/lang/en/bar.ftl
...

AFAICT, you can use FluentBundle::add_resource or ::add_resouce_overriding to add the contents of your files into a single bundle.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.