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.

Cursor springt of beweegt willekeurig tijdens het typen in Windows 10
Als u merkt dat uw muiscursor vanzelf springt of beweegt, automatisch, willekeurig tijdens het typen op een Windows-laptop of -computer, dan kunnen en...
De scrollrichting van de muis en touchpads omkeren in Windows 10
Muis en Touchpads maken computergebruik niet alleen eenvoudig, maar ook efficiënter en minder tijdrovend. We kunnen ons een leven zonder deze apparate...
Hoe de muisaanwijzer en cursorgrootte, kleur en schema op Windows 10 te veranderen
De muisaanwijzer en cursor in Windows 10 zijn zeer belangrijke aspecten van het besturingssysteem. Dit geldt ook voor andere besturingssystemen, dus i...