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.

Bitka za Wesnoth 1.13.6 Razvoj izdan
Bitka za Wesnoth 1.13.6, ki je izšel prejšnji mesec, je šesta razvojna izdaja v 1.13.x series in prinaša številne izboljšave, predvsem uporabniški vme...
Kako namestiti League Of Legends na Ubuntu 14.04
Če ste ljubitelj League of Legends, je to priložnost, da preizkusite League of Legends. Upoštevajte, da LOL podpira PlayOnLinux, če uporabljate Linux....
Namestite najnovejšo strategijo igre OpenRA v Ubuntu Linux
OpenRA je Libre / Free Real Time strateški stroj, ki poustvarja zgodnje igre Westwood, kot je klasična Command & Conquer: Red Alert. Porazdeljeni modi...