Skip to content

[Bug]: False positive "Translation not found" with partial string in Laravel JSON translation #374

Open
@WebCimes

Description

@WebCimes

Extension Version

Laravel v1.0.7

PHP Binary

Local PHP

Operating System

Windows

What happened?

Hello 👋

I'm encountering a false positive from the Laravel extension regarding JSON translations.

Here’s the situation:

In my Blade/PHP file, I have the following line:
__("Retrouver l'ensemble de vos commandes dans la section \"Commandes\".")
or
__('L\'authentification')

And in my en.json file, I have this key:
"Retrouver l'ensemble de vos commandes dans la section \"Commandes\" sur notre site.": "Find all your orders in the \"Orders\" section."
or
"L'authentification": "Authentication"

At runtime, the translation works correctly. Laravel is able to resolve the string without any issues.

However, the extension shows an error:

Translation [Retrouver l'ensemble de vos commandes dans la section "Commandes".] not found. Laravel Extension(translation)

or

Translation [L'authentification] not found.Laravel Extension(translation)

It seems like the extension is looking for an exact match in the JSON file and does not account for Laravel’s ability to perform partial/fuzzy matching at runtime.

Expected behavior:
The extension should either match the runtime behavior of Laravel more closely or at least not raise a warning when the translation works correctly in the app.

Let me know if you need any more information. Thanks!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions