Allow "splitting" translations?
Currently, my project grew to the point that I have countless lines of raw Fluent translations in one file, which has became a bit difficult to maintain. It would be awesome if the library would let you split these translations into different files, for example you could have a seperate file for lets say, payments, and another one for dialogues or commands. Something like the following is what I'm talking about:
.
└── locales/
├── en/
│ ├── commands/
│ │ ├── greeting.ftl
│ │ ├── goodbye.ftl
│ │ └── change_language.ftl
│ └── payments.ftl
└── fr/
├── commands/
│ ├── greeting.ftl
│ ├── goodbye.ftl
│ └── change_language.ftl
└── payments.ftl
And to not break anyone's code, maybe there can be an option which enables this feature?
export const i18n = new I18n<Context>({
defaultLocale: 'en',
directory: path.resolve(process.cwd(), 'locales'),
enableSplitTranslations: true, // Uses the directory provided above. Defaults to `false`, of course.
});
Perhaps (and apologies if this is not how the library works), this can be solved by walking every file and bundling all of them together into one translation? One issue I see with that approach is duplicate translation keys, an issue I'm not completely sure I know how to solve.
Apologies if this feature already exists in either this or the Fluent library, if it is, it would be great if someone could forward me to the related documentation as I tried searching for such feature and found nothing. Thanks!
This has been requested regularly, but so far, nobody has spent any time on this. Contributions are very welcome!