Comments (18)
hmm maybe that's the reason, will look at it in 30 minutes and get back to you. Thanks for your feedback, it's quite useful :)
I'm trying to make the package cover all the cases and make language files management as easy as possible, because in the current large project I'm working on managing translations became a nightmare.
from laravel-langman.
For instance, if I want to add a new language (italian for instance), I would basically create a new it
subfolder, then run the sync command and that folder would be populated with the new translation files.
from laravel-langman.
I just tested the case of having files existing in a language but not the other, running langman:missing
actually creates a new file and asks you to fill the lines key by key.
Can you please share the structure of your language files? Or if possible can you do some debugging inside the MissingCommand
and try to figure out where the problem is cause I can't replicate the issue here.
from laravel-langman.
@vpratfr, still having the same troubles running the package?
from laravel-langman.
Same problem after updating.
from laravel-langman.
I really need to know the cause of the issue, cause I've used langman in 4 projects till now with complicated localisation structure and it seem to work. Can you please try to track the issue in Themsaid/Langman/Command/MissingCommand.php
?
from laravel-langman.
I'll try to, but I won't have time to do that until at least 1 or 2 weeks.
from laravel-langman.
No worries, I'm going to close the issue for now then. Please feel free to open a ticket if the issue with more details by the time you check it out. Hopefully you catch the issue and open a PR :)
Thanks for your feedback.
from laravel-langman.
Pretty strange way to proceed to close an issue which is still happening?!
from laravel-langman.
It's just that we're unable to re-create the issue on different installation and you won't be able to provide further details so I thought to close it until somebody else reports. Anyway it's no opened again :)
from laravel-langman.
Here is some more info about the Exception:
$ php artisan langman:sync -v
Reading translation keys from views...
[ErrorException]
Undefined offset: 1
Exception trace:
() at vendor\themsaid\laravel-langman\src\Manager.php:64
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at vendor\themsaid\laravel-langman\src\Manager.php:64
Themsaid\Langman\Manager->Themsaid\Langman\{closure}() at vendor\laravel\framework\src\Illuminate\Support\Collection.php:347
Illuminate\Support\Collection->groupBy() at vendor\themsaid\laravel-langman\src\Manager.php:68
Themsaid\Langman\Manager->files() at vendor\themsaid\laravel-langman\src\Commands\SyncCommand.php:53
Themsaid\Langman\Commands\SyncCommand->handle() at n/a:n/a
...
from laravel-langman.
This happens for a file within vendor. At line 63 I do a var_dump($file);
and here is the output:
object(Symfony\Component\Finder\SplFileInfo)#873 (4) {
["relativePath":"Symfony\Component\Finder\SplFileInfo":private]=>
string(20) "vendor\log-viewer\en"
["relativePathname":"Symfony\Component\Finder\SplFileInfo":private]=>
string(32) "vendor\log-viewer\en\general.php"
["pathName":"SplFileInfo":private]=>
string(69) "C:\Dev\sites\ikastola\resources\lang\vendor\log-viewer\en\general.php"
["fileName":"SplFileInfo":private]=>
string(11) "general.php"
}
The exception is thrown because $matches is an empty array and you are trying to return $matches[1]
Here is what general.php looks like:
<?php
return [
'all' => 'All',
'date' => 'Date',
];
from laravel-langman.
A fix for that regex is to remove is and replace the if statement by that:
if (Str::contains($file->getPath(), 'vendor')) {
$fileName = basename($file->getRealPath());
$vendorName = basename(dirname($file->getPath()));
return "{$vendorName}::{$fileName}";
} else {
return $fileName;
}
from laravel-langman.
That last code seems to work (at least it runs, returns proper vendor::filename key), I did not check the messages which were output)
from laravel-langman.
π can you open a PR for that fix?
from laravel-langman.
I prefer to let you test it properly, I will not have time to do that before quite some time. I actually forced myself to spend a few minutes at least trying to find where the issue was to help you fix it.
I am running on Windows, that may be why your regex is not working.
The fix seems trivial, maybe mine is not proper as the function will return something like "log-viewer::general.php" (you may not want the .php ending in that return value)
from laravel-langman.
Alright no problem, I'll look into a fix and release a patch once I have a couple of minutes. Thank you :)
from laravel-langman.
No problem. Sorry I can't contribute more with code, I wish my days were 48 hours long.
from laravel-langman.
Related Issues (20)
- πCalling for help HOT 4
- Langman not compitable with laravel 8, HOT 5
- php 8 support HOT 1
- How we can use it in a project multilang Ar En? HOT 1
- Lang files are not PSR-2 HOT 3
- Disable URL on production HOT 2
- langman:sync autocreate
- Create lang file dynamically
- Utf8 Character Translation Not Working
- key with ' in it, breaks it
- Ignore files
- key with '.' in it, creates nested key
- Empty array on lang file throws offset error when syncing HOT 2
- Scan Error - Cannot read property 'Login' of undefined
- Specify language for missing
- Arabic (ar) support
- Lang files in sub-directories of the app not handled (non-vendor) HOT 1
- Laravel 6 compatibility HOT 4
- Cyrillic symbols is not working in not saving,
- Please fix with php 7.4 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-langman.