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.

Installer nyeste Dolphin Emulator for Gamecube & Wii på Linux
Dolphin Emulator lar deg spille de valgte Gamecube- og Wii-spillene dine på Linux Personal Computers (PC). Som en fritt tilgjengelig og åpen kildekod...
Hvordan bruke GameConqueror Cheat Engine i Linux
Artikkelen dekker en guide om bruk av GameConqueror-juksemotoren i Linux. Mange brukere som spiller spill på Windows bruker ofte "Cheat Engine" -appli...
Beste spillkonsollemulatorer for Linux
Denne artikkelen vil liste opp populære programvare for spillkonsollemulering tilgjengelig for Linux. Emulation er et programvarekompatibilitetslag so...