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

Prettier formatted code with line break not recognized by i18n-ally #1118

Open
dBianchii opened this issue Apr 3, 2024 · 3 comments
Open
Labels
bug Something isn't working

Comments

@dBianchii
Copy link

Describe the bug

image
vs
image

Extension Version

i18n Ally

Framework/i18n package you are using

next-international

To Reproduce
Steps to reproduce the behavior:
use this code snippet:

{t(
   "You are about to finish your shift and checkout Are you sure",
)}
  1. Go to '...'
  2. Click on '....'=
  3. See error

Device Infomation

  • OS:
  • Version:
  • VS Code Version:

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


Screenshots

@dBianchii dBianchii added the bug Something isn't working label Apr 3, 2024
@aldrin-dev
Copy link

You need to create a file named i18n-ally-custom-framework.yml in the root of your project. This file adds support for "Namespace", "rich", and "raw". Additionally, it properly handles long lines that prettier splits into multiple lines.

//i18n-ally-custom-framework.yml
languageIds:
  - javascript
  - typescript
  - javascriptreact
  - typescriptreact

usageMatchRegex:
  - "[^\\w\\d]t\\(['\"`]({key})['\"`]\\)"
  - "[^\\w\\d]t\\s*\\(\\s*['\"`]({key})['\"`]\\s*\\)"
  - "[^\\w\\d]t\\.rich\\(['\"`]({key})['\"`]\\)"
  - "[^\\w\\d]t\\.rich\\s*\\(\\s*['\"`]({key})['\"`]\\s*\\)"
  - "[^\\w\\d]t\\.raw\\(['\"`]({key})['\"`]\\)"
  - "[^\\w\\d]t\\.raw\\s*\\(\\s*['\"`]({key})['\"`]\\s*\\)"

scopeRangeRegex: "(?:useTranslations\\(|getTranslations\\(|namespace:)\\s*['\"`](.*?)['\"`]"

monopoly: true

@dBianchii
Copy link
Author

You need to create a file named i18n-ally-custom-framework.yml in the root of your project. This file adds support for "Namespace", "rich", and "raw". Additionally, it properly handles long lines that prettier splits into multiple lines.

//i18n-ally-custom-framework.yml
languageIds:
  - javascript
  - typescript
  - javascriptreact
  - typescriptreact

usageMatchRegex:
  - "[^\\w\\d]t\\(['\"`]({key})['\"`]\\)"
  - "[^\\w\\d]t\\s*\\(\\s*['\"`]({key})['\"`]\\s*\\)"
  - "[^\\w\\d]t\\.rich\\(['\"`]({key})['\"`]\\)"
  - "[^\\w\\d]t\\.rich\\s*\\(\\s*['\"`]({key})['\"`]\\s*\\)"
  - "[^\\w\\d]t\\.raw\\(['\"`]({key})['\"`]\\)"
  - "[^\\w\\d]t\\.raw\\s*\\(\\s*['\"`]({key})['\"`]\\s*\\)"

scopeRangeRegex: "(?:useTranslations\\(|getTranslations\\(|namespace:)\\s*['\"`](.*?)['\"`]"

monopoly: true

Hi, I added this to .vscode folder and no sucess. I reloaded my vscode but saw no changes. I also tried adding it to the root of my project

@aldrin-dev
Copy link

Adding it to the .vscode folder should work.

image

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

2 participants