i18n-ally
i18n-ally copied to clipboard
Language with country code separated by an underscore not detected correctly
Describe the bug We are using i18Next. Our language structure includes country codes separated with an underscore. The translation files are stored like this:
public/
├─ locales/
│ ├─ ch_de/
│ │ ├─ blocks.json
│ │ ├─ global.json
│ ├─ ch_fr/
│ │ ├─ blocks.json
│ │ ├─ global.json
│ ├─ de_de/
│ │ ├─ blocks.json
│ │ ├─ global.json
│ ├─ fr_fr/
│ │ ├─ blocks.json
│ │ ├─ global.json
│ ├─ int_en/
│ │ ├─ blocks.json
│ │ ├─ global.json
│ ├─ int_us/
│ │ ├─ blocks.json
│ │ ├─ global.json
But in my extension window it only shows 5 of the 6 languages:
ch
is mapped to ch_fr
and ch_de
is missing.
This is my config:
"i18n-ally.displayLanguage": "usa_en",
"i18n-ally.enabledFrameworks": ["react", "i18next"],
"i18n-ally.keystyle": "nested",
"i18n-ally.localeCountryMap": {
"usa": "us",
"int": "eu",
},
"i18n-ally.localesPaths": [ "public/locales" ],
"i18n-ally.namespace": true,
"i18n-ally.pathMatcher": "{locale}/{namespace}.json",
"i18n-ally.sortKeys": true,
"i18n-ally.sourceLanguage": "usa_en",
Extension Version i18n Ally v2.8.1
Framework/i18n package you are using react-i18next
To Reproduce Steps to reproduce the behavior:
- Copy my folder structure and config
- Take a look at the languages in the editor
- Edit the
ch
language. It maps toch_fr
Device Infomation
- OS: MacOS 12.2
- VS Code Version: 1.69.2 (Universal)
Extension Log
Go to View
-> Output
-> i18n Ally
, and paste the content below. You should mask any sensitive information
🈶 Activated, v2.8.1
――――――
💼 Workspace root changed to "/Users/adrian/git/tmh-website"
🌞 Enabled
🧩 Enabled frameworks: React, i18next
🧬 Enabled parsers: json, yaml, json5
📈 Telemetry id: 410b6cc8-a79e-4903-b1df-6ae52d6edfc9
🚀 Initializing loader "/Users/adrian/git/tmh-website"
📂 Directory structure: file
🗃 Custom Path Matcher: {locale}/{namespace}.json
🗃 Path Matcher Regex: /^(?<locale>[\w-_]+)\/(?<namespace>[^/\\]+)\.json$/
📂 Loading locales under /Users/adrian/git/tmh-website/public/locales
📑 Loading (ch) ch_de/blocks.json [1659510649838.73]
📑 Loading (ch) ch_de/global.json [1659517102345.439]
📑 Loading (ch) ch_fr/blocks.json [1659515122519.8425]
📑 Loading (ch) ch_fr/global.json [1659517136622.0867]
📑 Loading (de) de_de/blocks.json [1659510649875.938]
📑 Loading (de) de_de/global.json [1659517043954.018]
📑 Loading (fr) fr_fr/blocks.json [1659515031383.5266]
📑 Loading (fr) fr_fr/global.json [1659517136622.209]
📑 Loading (int) int_en/blocks.json [1659510649893.6594]
📑 Loading (int) int_en/global.json [1659517022272.547]
📑 Loading (usa) usa_en/blocks.json [1659515108539.0554]
📑 Loading (usa) usa_en/global.json [1659516984136.2002]
👀 Watching change on /Users/adrian/git/tmh-website/public/locales
✅ Loading finished
――――――
I had the same problem
Any news on this?
An option to disable the automatic mapping of languages (ch_XX
to ch
) would fix this.
I'm also having this problem. Our tooling uses underscores instead of hyphens, so we need to be able to detect this.