This repository has been archived by the owner on Jun 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added languages and setup base application
- Loading branch information
Showing
3 changed files
with
62 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class WelcomeController extends Controller | ||
{ | ||
function showGreetings(Request $request){ | ||
// retrieve the language from the GET parameter or default to English | ||
$language = $request->get('language', 'english'); | ||
|
||
$greetings = $this->greetings($language); | ||
$data = ['greetings' => $greetings]; | ||
|
||
// return the view template at `resources/views/welcome.blade.php` with the $greetings array. | ||
return view('welcome', $data); | ||
} | ||
function greetings($language) { | ||
switch ($language) { | ||
case "english": | ||
default: | ||
return [ | ||
"Hello", "Good Morning", "Good Afternoon", "Good Evening", "Thank you" | ||
]; | ||
case "german": | ||
return ["Hallo", "Guten Morgen", "Guten Nachmittag", "Guten Abend", "Danke"]; | ||
case "idoma": | ||
return ["Abole", "Uma ònnê", "Uma òchi", "Uma enò", "Ainya",]; | ||
case "yoruba": | ||
return ["E Pẹlẹ", "E kaaro", "E Kaasan", "E Kaale", "O ṣeun"]; | ||
case "french": | ||
return [ | ||
"Bonjour", "Bonjour", "Bonne après-midi", | ||
"Bonsoir", | ||
"Merci"]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters