Skip to content

fix: Analyze with AST for translation detection#328

Draft
thanhson13 wants to merge 1 commit intoslang-i18n:mainfrom
thanhson13:fix-analyze-with-intermediate-variables
Draft

fix: Analyze with AST for translation detection#328
thanhson13 wants to merge 1 commit intoslang-i18n:mainfrom
thanhson13:fix-analyze-with-intermediate-variables

Conversation

@thanhson13
Copy link

fix #310


TranslationUsageAnalyzer({required this.translateVar});

Set<String> analyzeFile(String filePath) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use String as an input so we can avoid file I/O in unit tests.
You can keep analyzeFile as a wrapper function for analyzeString / analyzeCode.

sdk: ">=3.3.0 <4.0.0"

dependencies:
analyzer: '>=6.0.0'
Copy link
Member

@Tienisto Tienisto Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will be biggest pain point. The slang package contains both the runtime and CLI tools.
Adding analyzer will introduce lots of transitive dependencies that should be only dev_dependencies.

@Tienisto
Copy link
Member

Overall, thank you for your contribution.
Either we can reimplement a simple AST parser ourself (which might be unfeasable) or we should create a separate package (e.g. slang_cli where we can freely use dev dependencies)

@thanhson13
Copy link
Author

Got it. I'll do some research on the analyzer package problem in my spare time. Always happy to lend a hand

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.

analyze does not detect translation key usage when keys are accessed via intermediate variables

2 participants

Comments