zerospam / laravel-gettext

Adds localization support to laravel applications using PoEdit and GNU-Gettext.
99 stars 56 forks source link

Support for custom msgid sources #13

Closed Arteneko closed 6 years ago

Arteneko commented 6 years ago

I have a code where I define a series of errors following this pattern:

$errMgr->add('No available article', 404);
$errMgr->add('Invalid request', 400);

note that they are all defined in a single file

I'd like to extract those and construct po files based on this first argument.

Instead of calling (_i('No available article'), 404);, I'd like to have some way to define a "standard" string format, e.g. a regex in the configuration, so running the php artisan gettext:update would directly re-create my po files, not only including my blade-defined calls to _i(), but also those error strings.

I guess it would be handled around here, where, instead of compiling blade views, it would instead directly read the file and try to match the configuration string against the file's content.

Belphemur commented 6 years ago

Hello,

Poedit is the one scanning the code for the defined keyword in the configuration and generating the po/pot file.

Laravel gettext is only loading the right language file.

I won't make this package scan source code for specific regex, this isn't the purpose of the package.