marhali / easy-i18n

This is a IntelliJ IDE based plugin for internationalization. Supports the most common translation file types.
MIT License
87 stars 27 forks source link

Support for nested locale structure in React projects #440

Open lukdev371 opened 1 month ago

lukdev371 commented 1 month ago

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