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.

Permainan Makmal Apl Oculus Teratas
Sekiranya anda adalah pemilik alat dengar Oculus, maka anda mesti mengetahui tentang memuatkan sideload. Sideloading adalah proses memasang kandungan ...
10 Permainan Teratas untuk Dimainkan di Ubuntu
Platform Windows telah menjadi salah satu platform dominan untuk permainan kerana peratusan besar permainan yang sedang berkembang hari ini untuk meny...
5 Permainan Arcade Terbaik untuk Linux
Pada masa kini, komputer adalah mesin serius yang digunakan untuk permainan. Sekiranya anda tidak dapat memperoleh skor tinggi baru, anda akan tahu ma...