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

Key with ";" and ":" cannot be parsed correctly as a key #1246

Open
stevencjyu opened this issue Dec 10, 2024 · 0 comments
Open

Key with ";" and ":" cannot be parsed correctly as a key #1246

stevencjyu opened this issue Dec 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@stevencjyu
Copy link

stevencjyu commented Dec 10, 2024

Describe the bug

We used Figma plugin to create and upload keys to a service. The plugin uses Figma node id as keys, so the keys would be something like I1177:488994;8975:1945;8975:1876.

But this kind of key cannot be parsed correctly by i18n-ally in our tsx or ts files:

t('I1177:488994;8975:1945;8975:1876')

We found that if a key contains ;, it cannot be found as a key.

And if a key contains :, it can be recognized as a key, but does not match the right content in the i18n resource files.

Extension Version

i18n Ally
v2.12.0

Framework/i18n package you are using

react-i18next

To Reproduce

  1. src/i18n/en/translation.json
{
  "test1:key": "test1",
  "test2;key": "test2",
  "test3.key": "test3"
}
  1. .vscode/setting.json
{
  "i18n-ally.localesPaths": [
    "src/i18n"
  ],
  "i18n-ally.dirStructure": "dir",
  "i18n-ally.enabledFrameworks": [
    "react-i18next"
  ],
  "i18n-ally.extract.targetPickingStrategy": "none",
  "i18n-ally.keystyle": "nested",
  "i18n-ally.pathMatcher": "{locale}/{namespace}.json",
  "i18n-ally.namespace": true,
  "i18n-ally.readonly": true
}
  1. src/Test.jsx
import { useTranslation } from 'react-i18next';

function Test() {
  const { t } = useTranslation();
  return (
    <>
      <div>{t('translation:test1:key')}</div>;
      <div>{t('translation:test2;key')}</div>;
      <div>{t('translation:test3.key')}</div>;
    </>
  )
}
  1. Check the i18n-ally panel.
  • test1:key would not match content in translation file.
  • test2;key would not be considered as a key.
  • test3:key works well.

截圖 2024-12-10 上午9 24 12

Device Infomation

  • OS: MacOS
  • Version: 15.1(24B83)
  • VS Code Version: Version: 1.95.3 (Universal)

Extension Log
Go to View -> Output -> i18n Ally, and paste the content below. You should mask any sensitive information

Screenshots

截圖 2024-12-10 上午9 24 12

@stevencjyu stevencjyu added the bug Something isn't working label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant