i18n: Add a folder structure option where locale is the root
- Dominant language
- JavaScript
- Stars
- 19.4k
- Forks
- 3.1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
Currently, internationalisation options allow us to store localised files in three structures:
- `multiple_folders` - persists files in `//.`
- `multiple_files` - persists files in `/..`
- `single_file` - persists a single file in `/.`
**Would there be an interest in adding an option such as `locale_folders` to specify the following structure: `//.`?**
For context, I am working with 11ty, and having `/en` and `/fr` folders for all of my localised content makes more sense with my configuration than having `/pages` and `/posts` folders that contain a folder for each locale. With locales as top-level folders, they can directly pass data down (e.g. `/en/en.json` data is available in for any file in my `/en/pages/*` folder, and I can adjust everything for one language in a single folder), which isn't possible with the `multiple_folders` structure, as far as I know.
I cloned this repo locally and did a quick test, editing the [`i18n.ts` file with the added support I am aiming for](https://gist.github.com/chriskirknielsen/237a39da068737af73de302b9f4717ff) — this edit, adding `locale_folders` into structure options, seems to provide the solution I am looking for, but I am not savvy enough to create all the tests required to form a clean PR for this, though the edits I made are minimal and seem to cover the bases.
Please let me know if I should provide additional details.
Contributor guide
Assessment
This issue has not been assessed yet.