This package helps to find missing translation strings in your Laravel blade files

v0.3.1 2024-01-22 11:28 UTC

This package is auto-updated.

Last update: 2024-04-23 07:16:38 UTC


This package helps to find missing translation strings in your Laravel blade files.


You can easily install this package using Composer, by running the following command:

composer require coding-socks/lost-in-translation --dev


You can list all missing translation for a specific location using the command below.

php artisan lost-in-translation:find {locale}


php artisan lost-in-translation:find nl

It is sometimes recommended to increase the verbosity using -v flag. In verbose mode the command will print warnings and errors to the standard output.


Publish the configuration file only:

php artisan vendor:publish --tag=lost-in-translation-config

Publish the Command class only:

php artisan vendor:publish --tag=lost-in-translation-commands


The command considers app.locale as your applications default locale.

The command scans your lang directory for comparison with the default and target locale.

The command scans your app, and resources/views directory for translation retrieval.

The command detects the following in your blade and application files:

  • @lang('key') Blade directives are compiled to app('translator')->get('key')
  • __('key') any call to the __ function
  • trans('key') any call to the trans function
  • trans_choice('key', x) any call to the trans_choice function
  • app('translator')->get('key') any direct getmethod call on the translator
  • App::make('translator')->get('key') any direct get method call on the translator
  • Lang::get('key') any get static call on the Lang facade
  • <<<'blade' inline components in nowdoc with blade label are compiled and their content is scanned.


  Find missing translation strings in your Laravel blade files

  lost-in-translation:find [options] [--] <locale>

  locale                The locale to be checked

      --sorted          Sort the values before printing
      --no-progress     Do not show the progress bar
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug


This implementation reads all your blade files, compiles them to PHP (illuminate/view), parses them as PHP (nikic/php-parser), and then finds the relevant nodes in the AST.

This, in my opinion, is a cleaner and less error-prone than using regular expressions.