Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dot notation to access array value set as "Not in use" #482

Closed
Andarius opened this issue Feb 18, 2021 · 2 comments
Closed

Dot notation to access array value set as "Not in use" #482

Andarius opened this issue Feb 18, 2021 · 2 comments
Assignees
Labels
bug Something isn't working sp:8

Comments

@Andarius
Copy link

Andarius commented Feb 18, 2021

Describe the bug
The following syntax is working fine but detected as "Not in use" in the usage report 'sideMenu.sections.0.items.0'

Extension Version
i18n Ally

Framework/i18n package you are using

react-i18next

To Reproduce

  1. Add const { t } = useTranslation() to your code
  2. Access an array using the dot notation: {t('sideMenu.sections.0.items.0')}

Device Infomation

  • OS: ubuntu
  • Version: 18.04
  • VS Code Version: 1.53.2

Extension Log

🈶 Activated, v2.4.22

――――――

💼 Workspace root changed to "my-app"
📦 Packages file "package.json" found
🕳 Packages file "pubspec.yaml" not exists
🕳 Packages file "composer.json" not exists
🕳 Packages file "Gemfile" not exists
🌞 Enabled
🧩 Enabled frameworks: React
🧬 Enabled parsers: json, yaml, json5

🚀 Initializing loader "my-app"
📂 Directory structure: file
🗃 Path Matcher Regex: /^(?<locale>[\w-_]+)\.(?<ext>json|ya?ml|json5)$/

📂 Loading locales under my-app/app/i18n/locales
	📑 Loading (en) en.json [1613583542634.1975]
	📑 Loading (fr) fr.json [1613583542634.1975]

👀 Watching change on my-app/app/i18n/locales
✅ Loading finished
@Andarius Andarius added the bug Something isn't working label Feb 18, 2021
@terales terales added the sp:8 label Mar 17, 2021
@terales terales added this to the Weekly cycle 004 milestone Mar 17, 2021
@antfu antfu closed this as completed in b732dd7 Mar 31, 2021
@apriltaoyvr
Copy link

Describe the bug
I am experiencing the same issue as the poster above, but the data in the keys will be displayed in the sidebar.
There is also an additional issue where when the translate button for missing/untranslated keys in an array is used, it will create it as an unnested key.

Extension Version
i18n Ally

Framework/i18n package you are using
next-18next

To Reproduce
For keys not found:

  • Add const { t } = useTranslation() to your code
  • Access an array using the dot notation: {t('sideMenu.sections.0.items.0')}
  • Check the sidebar
  • Click to see the key data is there

For untranslated keys:

  • Create a key with a missing translation
  • Translate the missing language text
  • Look a the .json of the translated text

Device Information
OS: Windows 11
Version: 10.0
VS Code Version: 1.67.2

Screenshots
Missing Key
image
image

Unnested json
image

Extension Log

🔄 File changed (change) fr/projects.json
	📑 Loading (fr) fr/projects.json [1653805748447.6692]
✅ Loading finished

🌍 Translating "levels101.paragraph[0]" (en->fr)
💾 Writing **file directory**
✅ Loading finished

🔄 File changed (change) fr/projects.json
	📑 Loading (fr) fr/projects.json [1653805751016.313]
✅ Loading finished

@lukaszraczylo
Copy link

Same here - hit the bug with flattened arrays being produced during the translation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sp:8
Development

No branches or pull requests

5 participants