-
Notifications
You must be signed in to change notification settings - Fork 16
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
Does not work with JSON (not in my case atleast) #27
Comments
Same here. Laravel 9. Directory |
+1: I am also experiencing the same issue on Laravel 9 inside a Docker container. |
I am using Laravel 10 if that helps the dev. |
Hey guys looking into this now! |
So I have tried running the artisan command on a new laravel 10 project with the .json files as you can see in this repository: https://github.com/LarsWiegers/laravel-translation-checker-testing Which works fine. Can you guys compare your repository against this one and share the difference? |
I am using single .json file, not directory languages. |
Our lang directory (in the root of the project) looks like this. There are multiple .php files inside each folder and we use a non-standard en-gb locale name too. da/ |
Thanks guys, this will help a ton! working on it now 😄 |
@bgurney do you know if laravel actively supports the combination of the use of subdirectories with PHP / json files and top level json files? Also I saw this in the documentation, maybe something to think about: https://laravel.com/docs/10.x/localization#defining-translation-strings:~:text=For%20languages%20that%20differ%20by%20territory%2C%20you%20should%20name%20the%20language%20directories%20according%20to%20the%20ISO%2015897.%20For%20example%2C%20%22en_GB%22%20should%20be%20used%20for%20British%20English%20rather%20than%20%22en%2Dgb%22. |
I have added a pr for testing purposes. Can you pull this in your projects and see if it works |
Yeah Laravel and it's various starter packs use a combination of PHP and JSON styles. Laravel Breeze, for example: I've never seen JSON files being used in the sub-folders though and can't see any mention of this in the docs. We also use the Laravel-Lang project, which provides boilerplate translations for a whole load of these things in both styles. So useful! |
Just tried it, and it kind of works I guess. Somewhat. Just did a recursive search to see where this is used and it's not used anywhere. I do use this line though: So it looks like it fails with the slash. You're close though. |
@mariusberget92 i have pushed new code that should fix your issue. Thanks guys! |
Thanks! |
Hi, thanks for working on this! However, we are using a combination of both PHP and JSON files, as the PHP ones are those we manage, and the JSON are from external services we just import. When used together, I get that translations are missing like this:
While it's not missing. It seems that the following is happening:
So it seems that the first level of keys are like ignored, or something else is going on when looping all keys, maybe with recursive looping over them and sub-objects? Or maybe it's the combination of having PHP and JSON? |
Location of translation file: lang/en.json
Contents: 500+ lines.
Small portion of the file:
Error:
Translations for the application works fine though. Just wanted to check if I missed some translations anywhere.
The text was updated successfully, but these errors were encountered: