lokalise / i18n-ally

🌍 All in one i18n extension for VS Code
https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally
MIT License
3.94k stars 315 forks source link

Supports enhanced namespace(s) #1165

Open fangyang921017 opened 3 months ago

fangyang921017 commented 3 months ago

Is your feature related to a specific framework or general for this extension react-i18next

Is your feature request related to a problem? Please describe. The issue that I am experiencing comes into play after passing a custom configuration object to i18next utilizing the resources option. As a result of this, i18n-ally is unable to locate the correct language configuration file.

Here is an example that entails my configuration:

image

And how I utilise it:

image

Currently, if I alter 'appDebug' to 'app-debug' as shown below, i18n-ally operates correctly. However, this modification does not correspond with my intended code usage.

image

Describe the solution you'd like My suggestion to resolve this issue is to facilitate a namespace(s)Map configuration which includes function support. The function should be able to accept the namespace(s), as extracted by i18n-ally, and subsequently return user-defined namespace(s).

ccjr1120 commented 3 months ago

I have the same requirement, for example, my language. json in src/views/AppHeader, and the data I put in the message will remove the src.views key, but I cannot match it with the plugin

dBianchii commented 2 months ago

I am having the same issue. I am using next-intl and I would like to be able to pass a t() object to a function with a specific namespace. Currently, i18n-ally does not detect the namespace of the t object I am using. https://github.com/amannn/next-intl/discussions/954#discussioncomment-10179307

dBianchii commented 2 months ago

I believe one solution would be to add a configurable option to namespaces, to allow for certain files/folders to all have a certain namespace prefixed configuration. EG:

"i18n-ally.pathsToNamespaces": {
  "**/validators/**": "validators", //all files inside validators folder should use a prefixed "validators" namespace
}
Chealer commented 1 month ago

What do you mean by "enhanced namespaces"? This may be related with tickets #804 adn #837 .