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

Find missing translation strings in blade files #94

Open
nerg4l opened this issue Jan 22, 2024 · 1 comment
Open

Find missing translation strings in blade files #94

nerg4l opened this issue Jan 22, 2024 · 1 comment

Comments

@nerg4l
Copy link

nerg4l commented Jan 22, 2024

Hello,

I recently developed a package (coding-socks/lost-in-translation) which is able to scan Blade files to identify translation strings and report if the translation for that string is missing from a locale.

u/boreasaurus on Reddit said the following:

It would be amazing if somehow this functionality existed in larastan, as that is already reporting errors for e.g. view('some.unknown.view')

In larastan/larastan#1822 I was informed that they probably meant this package and not Larastan.

My package provides a lost-in-translation:find {locale} artisan command which reads all blade files, compiles them to PHP, converts them to tokens, and then finds the relevant nodes in the AST (Abstract syntax tree). As far as I know, this is similar to how static analysis tools work.

I'm not sure if I will have enough time in the upcoming days but I would happily work on adding this feature if you think it's a good addition. However, I might require some guidance on where to start because I'm not familiar enough with PHPStan.

@AJenbo
Copy link
Contributor

AJenbo commented Jan 23, 2024

For performance reasons this tool might need a rewrite where it works more like what you describe. Currently it injections the compiled code as their analyser scans each file

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

No branches or pull requests

2 participants