Namespaces with slashes not working
See original GitHub issueDescribe the bug
Separating namespaces into subfolders, the namespace match with slashes donโt work. Thereโs a problem to support slashes as a namespace separator.
Locales structure:
locales
โโโ en-US
โโโ common.json
โโโ models
โ โโโ model-companies.json
โโโ pages
โโโ home.json
โโโ login.json
Namespace that i need to match:
t("pages/login:unauthorized.title")
i18n-ally settings:
"i18n-ally.localesPaths": ["public/locales"],
"i18n-ally.pathMatcher": "{locale}/{namespaces}.{ext}",
"i18n-ally.enabledParsers": ["json"],
"i18n-ally.namespace": true,
"i18n-ally.keystyle": "nested",
"i18n-ally.displayLanguage": "pt-BR",
"i18n-ally.enabledFrameworks": [ "react", "i18next"],
Extension Version i18n Ally v2.3.21
Framework/i18n package you are using next-i18next
Device Infomation
- OS: macOS Catalina
- Version: 10.15.6
- VS Code Version: 1.50.1
Extension Log
๐ผ Workspace root changed to "/Users/daniel/project"
๐ Enabled
๐งฉ Enabled frameworks: React, i18next
๐งฌ Enabled parsers: json
๐ Initializing loader "/Users/daniel/project"
๐ Directory structure: dir
๐ Custom Path Matcher: {locale}/{namespaces}.{ext}
๐ Path Matcher Regex: /^(?<locale>[\w-_]+)\/(?<namespace>.+)\.(?<ext>json|ya?ml|json5)$/
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Namespaces with slashes not working ยท Issue #425 - GitHub
Describe the bug Separating namespaces into subfolders, the namespace match with slashes don't work. There's a problem to support slashes asย ...
Read more >In php, namespaces a forward slash? - Stack Overflow
Are there any particular reasons for this? I feel the backslash convention is illogical because unix/linux file systems utilize forward slashes.
Read more >Naming Files, Paths, and Namespaces - Win32 apps
The backslash divides the file name from the path to it, and one directory name from another directory name in a path. You...
Read more >FAQ: things you need to know about namespaces - PHP
Class names that do not contain a backslash like name can be resolved in 2 different ways. If there is an import statement...
Read more >On PHP 5.3's Namespace Backslash Backlash
The problem is, the internals of PHP are that namespaces and classes are in different hashes and the call to either compile to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Should be supported in v2.4.4
Hi @antfu, An issue was opened on this subject in the i18next repository https://github.com/i18next/i18next/issues/1404, the maintainers do not mention the use of
:
for subfolders and the conclusion is that this is a feature for a few case and recommend creating your own customization of the framework to deal with it. https://www.i18next.com/misc/creating-own-pluginsHowever, I suspect there was a customization like this to work in this case. https://github.com/antfu/i18n-ally/issues/342#issuecomment-657492465 As mentioned by @haggen I also think that using โ:โ to separate both namespaces and subfolders can cause problems because if is a namespace or folder separator, it corresponds to different locales.