Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support namespaces #45

Open
micksabox opened this issue Dec 30, 2024 · 3 comments
Open

Support namespaces #45

micksabox opened this issue Dec 30, 2024 · 3 comments

Comments

@micksabox
Copy link

micksabox commented Dec 30, 2024

Hello, this is a great repo, thank you. I haven't been able to figure out if namespace support for i18next configured repos is possible. If not, I'll describe my use case and how I think it could be implemented.

My source translation files are split across several namespaces such as:

  • en/common.json
  • en/notfound.json
  • en/whitepaper.json

It's important for me to split up into namespaces so that I only load what is needed on a page by page basis, as some files can get big (whitepaper).

This could be configured in a namespaces key in the config, and supporting a glob for the files.format.include. This would iterate through the glob matches, and execute the run command but for each namespace detected, if configured. In addition to replacing [locale], the [ns] would also be replaced in the target path, if configured.

Alternatively, I could re-run the CLI command multiple times, one for each namespace, and dynamically load the namespace each time into the include string but native namespace support would be nice.

@pontusab
Copy link
Contributor

absolutely! on it 🫡

@Zigonja
Copy link

Zigonja commented Jan 1, 2025

As a workaround, you can add all of our namespace entry points into the files.[format].include part of the config config one by one, and that should do the trick at least until better support is implemented :)


  files: {
    json: {
      include: ["locales/[locale]/navigation.json", "locales/[locale]/translation.json", ....],
    },
  },

@micksabox
Copy link
Author

@Zigonja thats a good workaround, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants