easy-i18n icon indicating copy to clipboard operation
easy-i18n copied to clipboard

Support for nested locale structure in React projects

Open lukdev371 opened this issue 4 months ago • 0 comments

First of all, I want to say that I really enjoy using the easy i18n plugin—it's been incredibly helpful for managing translations in my project! I am working on a React project using i18next and the easy-i18n plugin. My locale structure is nested to support modularity, similar to this:

.
└── locales/
    ├── de/
    │   ├── context/
    │   │   ├── common.json -> common only for context
    │   │   └── login.json
    │   └── common.json -> general common
    └── en/
        ├── context/
        │   ├── common.json
        │   └── login.json
        └── common.json

This structure works well with i18next, but the easy-i18n plugin currently does not support it.

At least for the creation and the code completion, the plugin does not handle this correctly. Code completion leads to the separation of keys with the namespace separator. For example, it produces context:common:my_key.nested but it should be context/common:my_key.nested.

The plugin expects flat locale files directly under the language folder, which limits its use in projects with more complex and modular file structures.

Desired Behavior

It would be great if easy-i18n could support nested folder structures for locale files, similar to how i18next handles it. This would allow for more flexible and organized file management, especially in larger projects where multiple contexts or components have their own localized content.

Benefits

  • Improved compatibility with existing i18next setups
  • Better organization of locale files in larger projects
  • Enhanced scalability and maintainability for multilingual projects

lukdev371 avatar Oct 16 '24 09:10 lukdev371