Closed mariusberget92 closed 1 year ago
Same here. Laravel 9. Directory lang
in root folder. All strings are present but the command shows as ALL strings were missing.
+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?
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. Example: lang/en.json Not: lang/en/xxx.json
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/ de/ en-gb/ es/ export/ fr/ import/ it/ ni/ no/ pl/ da.ison de.ison en-gb.json es.ison fr.ison it.ison nl.ison no.json pl.json README.md
This is a screenshot of the errors I get when running translations:check
Thanks guys, this will help a ton! working on it now 😄
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/ de/ en-gb/ es/ export/ fr/ import/ it/ ni/ no/ pl/ da.ison de.ison en-gb.json es.ison fr.ison it.ison nl.ison no.json pl.json README.md
@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
composer require larswiegers/laravel-translations-checker:dev-json-files-instead-of-dirs
@bgurney do you know if laravel actively supports the combination of the use of subdirectories with PHP / json files and top level json files?
Yeah Laravel and it's various starter packs use a combination of PHP and JSON styles.
Laravel Breeze, for example: PHP style JSON style
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!
I get the following error when I run translations:check
now:
Just tried it, and it kind of works I guess. Somewhat.
I get this: Missing the translation with key: en.update the super admin.
Just did a recursive search to see where this is used and it's not used anywhere. I do use this line though: __('You cannot edit/update the super admin.')
So it looks like it fails with the slash. You're close though.
@mariusberget92 i have pushed new code that should fix your issue. @bgurney can you create a new issue as your situation is a little different.
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:
Missing the translation with key: dev.uuid
While it's not missing. It seems that the following is happening:
lang/dev/validation.php
contains uuid
keylang/en.json
contains validation.uuid
key (as sub-key, as we use sub-objects for better key management)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.