Search code examples
laravel-4localization

Laravel language files. Catch missing definitions


I am using Laravel's language capability in my app.

The problem I have is that if I call a language line the does not exist, the return value is the key used e.g.

Lang::get('messages.doesNotExist');

returns 'messages.doesNotExist'

Does Laravel provide any way to find out if language lines are missing? e.g. logging missing lines to an error log?

My concern is that I may not realize language lines are missing unless a user flags it to me.


Solution

  • From docs (http://laravel.com/docs/localization#basic-usage):

    Determine If A Language File Contains A Line

    if (Lang::has('messages.doesNotExist'))
    {
        //
    }