laravel

Determining if a Translation Exists

Determining if a Translation Exists

Problem

You want to determine if a translation exists for a particular key.

Solution

Use the Lang::has() method.

To check if a translation exists for the current locale pass a single argument to the method. The argument is the key you're checking.

if (Lang::has('message.welcome'))

echo "The welcome message translation exists for the current locale";

Discussion

You can specify the locale to check with the second argument.

if (Lang::has('message.welcome', 'es'))

echo "The welcome message translation exists for Spanish";

If the second argument isn't used then the current locale is used.

Как да промените курсора на мишката и размера на курсора, цвета и схемата в Windows 10
Показалецът на мишката и курсорът в Windows 10 са много важни аспекти на операционната система. Това може да се каже и за други операционни системи, т...
Безплатни и игри с отворен код за разработване на Linux игри
Тази статия ще обхване списък с безплатни двигатели за игри с отворен код, които могат да се използват за разработване на 2D и 3D игри на Linux. Същес...
Урок Сянка на Tomb Raider за Linux
Shadow of the Tomb Raider е дванадесетото допълнение към поредицата Tomb Raider - франчайз за екшън-приключенска игра, създаден от Eidos Montreal. Игр...