Skip to content

Resolve and safe constants cross-files#207

Merged
adrai merged 1 commit intoi18next:mainfrom
LudvigHz:variable-defs-importscopes
Mar 4, 2026
Merged

Resolve and safe constants cross-files#207
adrai merged 1 commit intoi18next:mainfrom
LudvigHz:variable-defs-importscopes

Conversation

@LudvigHz
Copy link
Contributor

@LudvigHz LudvigHz commented Mar 4, 2026

Another one from me here 😅

When importing variables from other files, we need to keep the
declarations so the declarations are saved for future reference when
processing other files.

This fixes cases where declarations of variables passed to useTranslation are defined in other
files. The quirk here is that you need to ensure the files containing the declarations are parsed
before any other usages of those declarations.

Checklist

  • only relevant code is changed (make a diff before you submit the PR)
  • run tests npm run test
  • tests are included
  • commit message and code follows the Developer's Certification of Origin

@adrai
Copy link
Member

adrai commented Mar 4, 2026

maybe not that easy, but can you try to create a test for that?

When importing variables from other files, we need to keep the
declarations so the declarations are saved for future reference when
processing other files.
@LudvigHz LudvigHz force-pushed the variable-defs-importscopes branch from bbceee3 to fd4b435 Compare March 4, 2026 14:06
@LudvigHz
Copy link
Contributor Author

LudvigHz commented Mar 4, 2026

maybe not that easy, but can you try to create a test for that?

Sure!
I added a test that should cover it now :)

@adrai adrai merged commit 77e1af2 into i18next:main Mar 4, 2026
8 checks passed
@adrai
Copy link
Member

adrai commented Mar 4, 2026

thx... included in v1.48.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants