Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

filipe1221's avatar

Using Translations

Iam using resources/lang to translations...

echo trans('messages.page_title');

return [ 'page_title' => 'QuickAdmin page' ];

Everything is fine... I just want to know if is any way to check if some string in Application using trans() function hasn't a translation

Thanks

0 likes
3 replies
hdsavani's avatar

Yes, you can do this way:

if (\Lang::has('general.token')) {

    // line exists.

} else {

   // line not exist.

}
1 like
filipe1221's avatar

maybe I did not explain it well ... I want a script that runs all my controllers and check if any string has no translation

Please or to participate in this conversation.