Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Translation Checker Laravel Package

bottelet/translation-checker

Laravel dev tool to scan your code for translation strings, detect missing keys in lang files (JSON/PHP), and sync them across locales. Optionally use AI to auto-translate missing entries; otherwise adds null placeholders to keep files consistent.

View on GitHub
Deep Wiki
Context7

title: Custom files layout: default parent: Advanced Usage nav_order: 1

Custom files

Extending the RegexExtractor for Custom File Types

By default, this package scans .blade.php and .php files for translation function calls. However, if you have implemented translation functions in other file types such as JavaScript (.js) or Vue (.vue) the package will automatically fallback to the RegexExtractor.

This allows you to extract translation strings from any file type using regular expressions.

Customizing the RegexExtractor

You can extend the RegexExtractor to match your custom translation functions by adding custom regex patterns.

This is done by binding a new instance of RegexExtractor in your AppServiceProvider and defining your patterns using the addPattern method.

Example 1: Add Custom Function

Suppose you have a custom translation function called myTranslateFunction() in your JavaScript files.

You can configure the RegexExtractor like this:

use App\Providers\AppServiceProvider;
use Vendor\Package\Extractors\RegexExtractor;

class AppServiceProvider extends ServiceProvider
{
    public function register()
    {
        app()->bind(RegexExtractor::class, function () {
            return (new RegexExtractor)
            ->addPattern(
                regex: '/myTranslateFunction\((["\'])(.*?)\1\)/',
                matchIndex: 2,
                group: 'myTranslateFunction'
            );
        });
    }
}

This pattern will match instances like:

myTranslateFunction('Hello, world!')

Parameters Explained

  • regex: The regular expression pattern that matches your translation function calls.
  • matchIndex: The index of the capturing group in your regex that contains the string to extract.
  • group: A label used to group extracted strings from similar functions.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport