Multiple nested translation files support
Opened this issue · 1 comments
Thanks for putting this package together!
The readme seems to assume that translation files will be flat and singular. I'm wondering how I could support nested translation files like:
/locales
/subfolder1
en.yaml
de.yaml
/subfolder2
en.yaml
de.yaml
I've considered recursively sorting and combining them before adding each locale to the i18n.translations object, but I'd like to retain some sort of granular control when using the translations with, as mentioned in another issue, setting a default namespace in const { t } = useTranslation('subfolder1');
to the subfolder, and then getting the text with t('keys.to.text')
.
Is this something that can be supported? Thanks!
Hi dmoz-ixl,
Thank you for your interest and suggestion.
I thought about your proposal and decided that this is not something I will implement in this package. It would add too many unforeseeable combinations while, at the same time, you can achieve it with a build step.
You can merge the JSON files from your subfolders into one language-specific file during the build.
Cheers!